Sum
Get Sum of amount by a select filter using C# MVC Entity Framework
First Method
dbConnection db = new dbConnection();
int InvoiceAmount = db.Bill.Where(x => x.CID == 123).Select(i => i.Amount).Sum();
Second Method
data.Where(x => x.msg == "paid").Sum(y => Convert.ToInt32(y.Amount));
No comments:
Post a Comment