Hello Team,
Am trying to sum up the quantity and Total Amount in my dataTable footer, but is showing underline red, how do I modified the code to to perform this sumation and the total should only display the Quantity and TotalAmount at the footer after a date range is selected such as StartDate to EndDate ,
public ActionResult getNewOrder()
{
using (db = new ASPNETMASTERPOSTEntities())
{
var dataList = db.tblCustomers.Include("tblOrders");
var modifiedData = dataList.AsEnumerable().SelectMany(x => x.tblOrders.Select(d => new OrderViewModel
{
CustomerId = x.CustomerId,
CustomerName = d.tblCustomer.CustomerName,
PhoneNo = d.tblCustomer.PhoneNo,
OrderDate = d.tblCustomer.OrderDate,
CategoryName = d.CategoryName,
ProductName = d.ProductName,
Quantity = d.Sum(x=>x.tblOrders.Quantity),
UnitPrice = d.UnitPrice,
TotalAmount = d.Sum(x => x.tblOrders.TotalAmount),
OrderId = d.OrderId
})).ToList();
return Json(modifiedData, JsonRequestBehavior.AllowGet);
}
}