public async Task <ActionResult> Index() { HomeViewModel viewModel = new HomeViewModel(); IReadOnlyDictionary <uint, LeagueModel> leagues = null; try { leagues = await db.GetLeaguesAsync(); } catch (HttpRequestException) { } // maybe log this in the future, for now do nothing viewModel.LeagueCount = leagues != null ? (int?)leagues.Count : null; var gameItems = await db.GetGameItemsAsync(); var schema = await db.GetSchemaAsync(); var heroes = await db.GetHeroDetailsAsync(); var heroAbilities = await db.GetHeroAbilitiesAsync(); viewModel.HeroCount = heroes.Count; viewModel.HeroAbilityCount = heroAbilities.Count; viewModel.ShopItemCount = schema.Items.Count; viewModel.InGameItemCount = gameItems.Count; int?liveLeagueGameCount = null; try { liveLeagueGameCount = await db.GetLiveLeagueGameCountAsync(); } catch (HttpRequestException) { // live league game endpoints return 500 or 404 randomly and without warning // maybe log this in the future, for now do nothing } viewModel.LiveLeagueGameCount = liveLeagueGameCount; var playerCounts = await db.GetPlayerCountsAsync(); viewModel.InGamePlayerCount = playerCounts.InGamePlayerCount; viewModel.DailyPeakPlayerCount = playerCounts.DailyPeakPlayerCount; viewModel.AllTimePeakPlayerCount = playerCounts.AllTimePeakPlayerCount; LiveLeagueGameOverviewViewModel topLiveLeagueGame = null; try { topLiveLeagueGame = await GetTopLiveLeagueGameAsync(); } catch (HttpRequestException) { // live league game endpoints return 500 or 404 randomly and without warning // maybe log this in the future, for now do nothing } viewModel.TopLiveLeagueGame = topLiveLeagueGame; viewModel.RandomHero = GetRandomHeroViewModel(heroes); await SetupRandomItems(viewModel, gameItems); var dotaBlogFeedItems = db.GetDotaBlogFeedItemsAsync(); viewModel.DotaBlogFeedItems = AutoMapperConfiguration.Mapper.Map < IReadOnlyCollection <DotaBlogFeedItem>, IReadOnlyCollection <DotaBlogFeedItemViewModel> > (dotaBlogFeedItems); return(View(viewModel)); }