I have a dotnet core (+razor +ef) application with the usual model of a Product
:-)
A product should have a picture associated, uploaded from the Products\Create.cshtml
and Products\Edit.cshtml
pages, stored in a table of the DB, and showed in the Products\Details.cshtml
.
My model is something like this:
public class Product
{
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public decimal Price { get; set; }
public byte[] Image { get; set; }
}
First question: is it correct the use of byte[]
for the picture?
Second question: since I guess I cannot automatically scaffolding the CRUD pages for a picture, how can I upload the image from the razor Create.cshtml
page?
Thanks a lot