Add photos and gallery to an ASP MVC product

2

I'm starting in ASP.NET using mvc 5, I've done some basics courses, and now I want to make a simple little complex virtual store. but I am in a crucial doubt in the product table, it will have a miniature photo and more others in its description,

public class Produto
{

    public int PRODUTOID { get; set; }

    public int CATEGORIAID { get; set; }

    public string NOME { get; set; }


    [Display(Name = "Imagem")]
    [DataType(DataType.ImageUrl)]
    public string FOTO { get; set; }

    public decimal PRECO_UNITARIO { get; set; }

    public string QUANTIDADE_ESTOQUE { get; set; }


    public virtual ICollection<Categoria> Categoria { get; set; }
}

My question is how do I add more image to this product when the person is seeing product details? would I have to create another "gallery" table and relate to the product in question?

    
asked by anonymous 13.12.2017 / 18:58

1 answer

0

Yes, it is possible to do everything in string so

You can put all the images in the same field FOTO and separate the fonts using ";" and when the user makes the call you only need to .split(";") and return the list of images.

example:

string[] fotos= FOTO.Split(';');
    
15.12.2017 / 16:26