2
I’m starting in Asp.net using mvc 5, I’ve taken some basic 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 thumbnail photo and more the 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 that product when the person goes to see product details? i would have to create another table "gallery" and relate to the product in question?
If you want to have an unlimited number of images for your products, which is more common, you will need to create another table to store these urls. If it’s a restricted number, you can simply add new columns like FOTO_UM, FOTO_DOIS and etc... (What’s not elegant at all)
– Leandro Angelo