Example #1
0
        public List <NeedASummary> NeedAssessmentByYear(int year)
        {
            var yearNeedAssessment = _unitOfWork.NeedAssessmetSummaryRepository.FindBy(r => r.Year == year);

            var q = from y in yearNeedAssessment
                    orderby y.RegionName
                    group y by y.RegionName into No
                    select new NeedASummary()
            {
                RegionName          = No.Key,                             //from r in y
                Belg_Beneficiaries  = No.Where(t => t.Season == "Belg").Sum(t => t.TotalBeneficiaries),
                Meher_Beneficiaries = No.Where(t => t.Season == "Meher").Sum(t => t.TotalBeneficiaries)
            };

            return(q.ToList());
        }