Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.33 KB | None | 0 0
  1. return await context.Products.Select(p => new ProductListModel
  2. {
  3.     Id = p.Id,
  4.     Name = p.Name,
  5.     Price = p.Price,
  6.     Description = p.Description,
  7.     PictureUrl = p.PictureUrl,
  8.     Categories =  p.ProductCategories.Select(pc => new CategoryListModel
  9.                 {
  10.                     Id = pc.Category.Id,
  11.                     Name = pc.Category.Name
  12.                 })
  13. }).ToListAsnyc();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement