public ActionResult GetDashboardByProvincePartialView(string iso) { var model = new CovidDataViewModel(); model.IsoCode = iso; try { if (string.IsNullOrEmpty(iso)) { var viewData = _reportService.GetTop10CovidCasesByCountry(); model.Top10RegionsData = viewData.ToDictionary(x => x.Key.RegionName, x => x.Value); } else { var viewData = _reportService.GetTop10CovidCasesByCountryRegions(iso); model.Top10RegionsData = viewData.ToDictionary(x => x.Key.Province, x => x.Value); } return(PartialView("TableDashboard", model)); } catch (ApiClientException) { return(PartialView("TableDashboard", model)); } }
public ActionResult Index() { var model = new CovidDataViewModel(); try { var viewData = _reportService.GetTop10CovidCasesByCountry(); model.Top10RegionsData = viewData.ToDictionary(x => x.Key.RegionName, x => x.Value); model.OptionsList = viewData .Select(x => new SelectListItem() { Value = x.Key.Iso, Text = x.Key.RegionName }) .ToList(); return(View(model)); } catch (ApiClientException) { return(View(model)); } }