I'm using Linq-to-Entities for querying, and MVC.NET and C# for coding. I'm trying to generate monthly donor registry report which needs donor count, donors who signed through web,donors who registered in current month and all this is to be display per county.private MonthlySummaryViewModelBuildMonthlySummaryViewModel(MonthlySummarySubModel model){// Get the bounding datetimes for the previous and lookup monthDateTime curr = new DateTime(model.Year, model.Month, 1),                  prev = curr.AddMonths(-1),    next = curr.AddMonths(1);      var monthlySummary = (from county in context.Counties.AsEnumerable()                          let query = context.DonorStatusActions.Where(x => x.Donor.CountyId == county.CountyId && x.ActionTakenOn >= prev && x.ActionTakenOn < next)let data = query.GroupBy(x => x.Donor, x => x, (key, grp) => new {Item1 = key, Item2 = grp.OrderByDescending(y => y.ActionTakenOn).FirstOrDefault()})                                                                   .Where(x => x.Item2.IsDonor && ((model.WebSignUp != 2 && x.Item2.Donor.WebSignUp == (model.WebSignUp == 1 ? true : false)) || model.WebSignUp == 2))                                    let registrations = data.Select(x => x.Item2)                                     let previous = registrations.Count(x => x.ActionTakenOn >= prev && x.ActionTakenOn < curr)                                                                                let current = registrations.Count(x => x.ActionTakenOn >= curr && x.ActionTakenOn < next)    select Tuple.Create(county.Name, previous, current)).ToList(); return new MonthlySummaryViewModel() {    Month = new System.Globalization.DateTimeFormatInfo().GetMonthName(model.Month),  Year = model.Year,  WebSignUp=DropDownLists.SignUpMethodList.First(m => m.Value==model.WebSignUp).Text,CountyData = monthlySummary,  TotalPrevious = monthlySummary.Sum(x => x.Item2),  TotalReport = monthlySummary.Sum(x => x.Item3), };}
Linq to entities query for donor registrations
c#;linq;entity framework