Hello Team,
Please I need your assistance, in my controller I want to group sales by date and sum of the quantity and total sales
public ActionResult GetAllSalesRecord() { ASPNETMASTERPOSTEntities db = new ASPNETMASTERPOSTEntities();
var dataList = db.tblSales.Join( db.tblSalesDetails, sales => sales.SalesId, detail => detail.SalesId, (sales, detail) => new { Sales = sales, detail = detail }); var modifiedData = dataList.Select(x => new
{ SalesDetailId = x.detail.SalesDetailId, Quantity = x.detail.Quantity, ProductId = x.detail.ProductId, ProductName = x.detail.tblProduct.ProductName, SalesId = x.Sales.SalesId, OrderDate = x.Sales.OrderDate, TotalAmount = x.Sales.TotalAmount }).ToList(); return Json(modifiedData, JsonRequestBehavior.AllowGet); }