Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. var qry = _productRepository.Table.GroupJoin(_categoriesRepository.Table,
  2. p => p.CategoryId,
  3. c => c.Id,
  4. (p, c) => new { Product = p, Categories = c.DefaultIfEmpty() })
  5. .Where(hdg => hdg.Product.Hidden == false)
  6.  
  7. .SelectMany(final => final.Categories,
  8. (final, c) => new CatalogItemResponse
  9. {
  10. ChildrenCategoryId = final.Product.ChildrenCategoryId,
  11. //DistributionCenterErpId = final.Product.DistributionCenterErpId,
  12. //Atribuições
  13. .......
  14. }).ToList();
  15.  
  16. qry.ForEach(q =>
  17. {
  18. var product = new Product();
  19.  
  20. product.CategoryId = q.CategoryId;
  21. product.AuthorizeMaximumPercentageAlteration = q.AuthorizeMaximumPercentageAlteration;
  22. product.AuthorizeMinimumPercentageAlteration = q.AuthorizeMinimumPercentageAlteration;
  23. product.HaveMaximumPercentage = q.HaveMaximumPercentage;
  24. product.HaveMinimumPercentage = q.HaveMinimumPercentage;
  25. product.Hidden = q.Hidden;
  26. product.ChildrenCategoryId = q.ChildrenCategoryId;
  27. product.Description = q.Description;
  28. //product.DistributionCenterErpId = q.DistributionCenterErpId;
  29. //Mais atribuições e etc
  30. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement