Hello Team,
I want to select sales per base on the each user.
// Select servedBy base on the sales per user public ActionResult GetAdminReport( string sDate = null, string eDate = null) {
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.GroupBy(x => new { x.Sales.OrderDate, x.detail.ProductId }).Select(x => new AdminReports
{ SalesDetailId = x.FirstOrDefault().detail.SalesDetailId, Quantity = x.Sum(s => s.detail.Quantity), ProductId = x.Key.ProductId, ProductName = x.FirstOrDefault().detail.tblProduct.ProductName, SalesId = x.FirstOrDefault().Sales.SalesId, stOrderDate = x.Key.OrderDate, TotalAmount = x.Sum(s => s.Sales.TotalAmount), SearvedById = x.FirstOrDefault().Sales.Createdby }).ToList();
return Json(responseData, JsonRequestBehavior.AllowGet); }