how can I convert the LINQ query below and convert into model?
var sales = _context.Sales
.Include(x => x.Product)
.GroupBy(x => new { x.ProductId, x.Name})
.Select(g => new{
Id = g.Key,
Name = g.Key.Name,
Quantity = g.Sum(s => s.Quantity)
});
var list = (List)sales;
public class SupplyModel
{
public Guid Id { get; set; }
public string Name { get; set; }
public int Quantity { get; set; }
}

Sachin SinghRank #66 · 26.2K reputationPosted Feb 24, 2021, 8:15 AM EST
Rijwan AnsariRank #82 · 24.2K reputationPosted Feb 24, 2021, 1:04 PM EST