I have to convert my given linq query in lambda expression. i.e.
var scholars = (from scholar in db.Scholars
join suspension in db.Suspensions
on scholar.ID equals suspension.ScholarID
where suspension.StartDate >= startDate &&
suspension.EndDate <= endDate
group scholar by new { scholar.ID, scholar.FirstName, scholar.LastName }
into g
select new
{
FullName = g.Key.FirstName +" " + g.Key.LastName,
TotalSuspensionSum = g.Sum(x => x.Suspensions.Sum(y => y.SuspensionDays))
})
.ToList()
.OrderBy(x=> x.FullName);
Well I don't think I should do all your work for you but specifically the group by you are asking about could be done like:
this is your lambda: