public ActionResult Index(KpiListViewModel postedModel) { IEnumerable <CdmaRegionStat> stats = cdmaStatRepository.Stats.ToList().GetLastDateStats( regionRepository.GetAllList(), postedModel.StatDate); DateTime endDate = (stats.Any()) ? stats.First().StatDate : DateTime.Today.AddDays(-1); KpiListViewModel viewModel = new KpiListViewModel { CdmaStats = stats, EndDate = endDate, StatDate = endDate, StartDate = endDate.AddDays(-7), Cities = regionNamesService.Query().ToList() }; return(View(viewModel)); }
private void Import(IEnumerable <TStat> stats) { OverallDates = stats.Select(x => x.StatDate).Distinct().OrderBy(x => x).Select(x => x.ToShortDateString()); IEnumerable <string> categories = service.Query(); foreach (string category in categories) { IEnumerable <TStat> currentCategoryStats = GetCurrentCategoryStats(stats, category); if (currentCategoryStats.Any()) { Stats.Add(category, GetDailyStatList(currentCategoryStats, category)); } } }
public ActionResult Precise4G(KpiListViewModel postedModel) { IEnumerable <TownPrecise4GView> stats = townPrecise4GRepository.Stats.GetLastDateStats( townRepository.GetAllList(), postedModel.StatDate); DateTime endDate = (stats.Any()) ? stats.First().StatDate : DateTime.Today.AddDays(-1); Precise4GViewModel viewModel = new Precise4GViewModel { EndDate = endDate, StatDate = endDate, StartDate = endDate.AddDays(-7), PreciseStats = stats, Districts = districtNamesService.Query() }; return(View(viewModel)); }