Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. public int Id {get; set;}
  2. public int S {get; set;}
  3. public int M {get; set;}
  4. public int L {get; set;}
  5. public int ProductId {get;set;}
  6. public Product Product {get; set;}
  7.  
  8. var product = db.Products.FirstOrDefault(p => p.Id == productId);
  9. var availableSizes = from s in db.ProductSizes where (s.Id == productId) select s;
  10. List<string> Sizes = new List<string>();
  11. foreach (var s in availableSizes)
  12. {
  13. if(s.S == true)
  14. {
  15. Sizes.Add("S");
  16. }
  17. if(s.M == true)
  18. {
  19. Sizes.Add("M");
  20. }
  21. if (s.L == true)
  22. {
  23. Sizes.Add("L");
  24. }
  25. if (s.Xl == true)
  26. {
  27. Sizes.Add("XL");
  28. }
  29. if (s.Xxl == true)
  30. {
  31. Sizes.Add("XXL");
  32. }
  33. }
  34. return Sizes;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement