public AllDistrictComparisonsDto CreateResponseObject()
        {
            var response = new AllDistrictComparisonsDto
            {
                DistrictFiscalYearMetrics = new List <DistrictComparisonDto>()
            };

            //get fiscal years
            var fiscalYears = FiscalYearsService.GetSupportedYears();

            response.FiscalYears = fiscalYears.ToDictionary(x => x.FiscalYearId, x => x.Name);

            //create comparison record for every district
            var districts = DistrictsService.GetAll();

            foreach (var district in districts)
            {
                var districtData = new DistrictComparisonDto
                {
                    District            = district,
                    MetricsByFiscalYear = fiscalYears.ToDictionary(x => x.FiscalYearId, x => new DistrictFiscalYearMetrics
                    {
                        Metrics = new Dictionary <ComparisonType, object>()
                    })
                };
                response.DistrictFiscalYearMetrics.Add(districtData);
            }

            return(response);
        }
 public IEnumerable <DistrictsDto> Get()
 {
     Logger.LogDebug("Made it past cache...fetching data");
     return(DistrictsService.GetAll());
 }
Esempio n. 3
0
        public List <District> Get()
        {
            var districts = _districtsService.GetAll();

            return(districts);
        }
Esempio n. 4
0
        public async Task <ActionResult <IEnumerable <District> > > GetDistricts()
        {
            var districts = await _districtsService.GetAll();

            return(Ok(_mapper.Map <IEnumerable <DistrictDTO> >(districts)));
        }