public async Task <IActionResult> Details(int?id) { if (id is null) { return(NotFound()); } var teamSeason = await _teamSeasonRepository.GetTeamSeasonAsync(id.Value); if (teamSeason is null) { return(NotFound()); } _teamSeasonsDetailsViewModel.TeamSeason = teamSeason; var teamName = teamSeason.TeamName; var seasonYear = teamSeason.SeasonYear; _teamSeasonsDetailsViewModel.TeamSeasonScheduleProfile = await _teamSeasonScheduleRepository.GetTeamSeasonScheduleProfileAsync(teamName, seasonYear); _teamSeasonsDetailsViewModel.TeamSeasonScheduleTotals = await _teamSeasonScheduleRepository.GetTeamSeasonScheduleTotalsAsync(teamName, seasonYear); _teamSeasonsDetailsViewModel.TeamSeasonScheduleAverages = await _teamSeasonScheduleRepository.GetTeamSeasonScheduleAveragesAsync(teamName, seasonYear); return(View(_teamSeasonsDetailsViewModel)); }
public async Task <ActionResult <TeamSeasonModel> > GetTeamSeason(int id) { try { var teamSeason = await _teamSeasonRepository.GetTeamSeasonAsync(id); if (teamSeason is null) { return(NotFound()); } return(_mapper.Map <TeamSeasonModel>(teamSeason)); } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError, Settings.DatabaseFailureString)); } }
public async Task <IActionResult> Details(int?id) { if (id is null) { return(NotFound()); } var teamSeason = await _teamSeasonRepository.GetTeamSeasonAsync(id.Value); if (teamSeason is null) { return(NotFound()); } _teamSeasonsDetailsViewModel.TeamSeason = teamSeason; return(View(_teamSeasonsDetailsViewModel)); }