Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int Id {get; set;}
- public int S {get; set;}
- public int M {get; set;}
- public int L {get; set;}
- public int ProductId {get;set;}
- public Product Product {get; set;}
- var product = db.Products.FirstOrDefault(p => p.Id == productId);
- var availableSizes = from s in db.ProductSizes where (s.Id == productId) select s;
- List<string> Sizes = new List<string>();
- foreach (var s in availableSizes)
- {
- if(s.S == true)
- {
- Sizes.Add("S");
- }
- if(s.M == true)
- {
- Sizes.Add("M");
- }
- if (s.L == true)
- {
- Sizes.Add("L");
- }
- if (s.Xl == true)
- {
- Sizes.Add("XL");
- }
- if (s.Xxl == true)
- {
- Sizes.Add("XXL");
- }
- }
- return Sizes;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement