Group By and Sum using Linq On Entity
It requires to get group by with sum.
var amount = plod.objProduct.Where(i => i.SID == nslres.SID).GroupBy(s => s.SID).Select(x => new { Totamt = x.Sum(y => y.PrdPrice) }).FirstOrDefault().Totamt;
It requires to get group by with sum.
var amount = plod.objProduct.Where(i => i.SID == nslres.SID).GroupBy(s => s.SID).Select(x => new { Totamt = x.Sum(y => y.PrdPrice) }).FirstOrDefault().Totamt;
Leave a Reply