using System.Collections.Generic;
public static void Main()
var Db = new List<Checkout>()
IsCheckoutComplete = true,
OrderDate = new DateTime(10, 10, 10),
IsCheckoutComplete = true,
OrderDate = new DateTime(11, 11, 11),
IsCheckoutComplete = true,
OrderDate = new DateTime(11, 11, 11),
IsCheckoutComplete = true,
OrderDate = new DateTime(10, 10, 10),
var list = Db.Where(x => x.IsCheckoutComplete)
.GroupBy(x => new { OrderDate = x.Order.OrderDate.Date})
.Select(a => new { OrderDate = a.Key.OrderDate, TotalPrice = a.Sum(b => b.Order.TotalPrice)})
.OrderBy(c => c.OrderDate)
foreach(var item in list)
Console.WriteLine("{0} -- {1}", item.OrderDate, item.TotalPrice);
public bool IsCheckoutComplete {get;set;}
public Order Order {get;set;}
public DateTime OrderDate {get;set;}
public decimal TotalPrice {get;set;}