I save my image in the sql server database, but I do not know how I can show it in another view in asp.net core.
the image that I keep, I do it in the following way:
public async Task<IActionResult> Registro(UsuarioRegister user, List<IFormFile> Foto)
{
if (ModelState.IsValid)
{
if (Foto.Count == 1)
{
foreach (var item in Foto)
{
if (item.Length > 0)
{
using (var stream = new MemoryStream())
{
await item.CopyToAsync(stream);
user.Foto = stream.ToArray();
}
}
}
}
var usuario = new Usuario
{
Foto = user.Foto
};
_context.SaveChanges();
}
public class UsuarioRegister
{
public byte[] Foto { get; set; }
}
in the database, I keep the photo with the following type of data
foto varbinary(max) null
How can I show this saved photo, in another view?