0
I have a question about how to model the table Produto
of a small e-commerce I’m doing. I have been seeing some e-commerces and came across the following situation: mm same product can have different colors and sizes, so when the customer chooses the product in a different color the system pulls the same product but with different color and available size, thus, apparently the product is registered more than 1x with the same name, however, different colors and sizes, even pq the product code is always different, ie the same product can have several codes, sizes, different colors but the name is always the same, and I believe that this is the jump of the cat, correct me if I’m wrong.
Following this logic, I’m trying to model my class of Produto
in this way, but I came across an impasse in the stock, because the product can have the same name, different codes, different colors, different sizes, but managing the stock from the size becomes kind of complicated, because the same product may have different sizes in stock and at the time to give the exit of the stock I need to rely on this situation. So I wanted to know the best way to do it?
Product table.
[Serializable]
public class Produto{
public virtual long id { get; set; }
public virtual String descricao { get; set; }
public virtual String descDetalhada { get; set; }
public virtual Subcategoria subcategoria { get; set; }
public virtual IList<Cor> cores { get; set; }
public virtual IList<Tamanho> tamanhos { get; set; }
public virtual int qtdEstoque { get; set; }
public virtual decimal precoAntigo { get; set; }
public virtual decimal precoReal { get; set; }
public virtual int status { get; set; }
public Produto(){
cores = new List<Cor>();
tamanhos = new List<Tamanho>();
}
public override string ToString(){
return descricao;
}
}
Have any answers solved what was in doubt? Do you need something else to be improved? Do you think it is possible to accept it now?
– Maniero