public async Task <IActionResult> Index() { var seasons = (await _seasonRepository.GetSeasonsAsync()).OrderByDescending(s => s.Year); _seasonStandingsIndexViewModel.Seasons = new SelectList(seasons, "Year", "Year", SelectedSeasonYear); _seasonStandingsIndexViewModel.SelectedSeasonYear = SelectedSeasonYear; _seasonStandingsIndexViewModel.SeasonStandings = await _seasonStandingsRepository.GetSeasonStandingsAsync(SelectedSeasonYear); return(View(_seasonStandingsIndexViewModel)); }
public async Task <ActionResult <SeasonTeamStandingModel[]> > GetSeasonStandings(int seasonYear) { try { var seasonStandings = await _seasonStandingsRepository.GetSeasonStandingsAsync(seasonYear); return(_mapper.Map <SeasonTeamStandingModel[]>(seasonStandings)); } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError, Settings.DatabaseFailureString)); } }