TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Geni Lou
NA
101
24.3k
LINQ Query convert to DTO
Feb 24 2021 12:31 PM
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<ProductModel>)sales;
public class SupplyModel
{
public Guid Id { get; set; }
public string Name { get; set; }
public int Quantity { get; set; }
}
Reply
Answers (
2
)
How to get client's IP address and port in UDP Echo server
Aggregate in SQL Server