public async Task <IActionResult> OnGetAsync(int?id) { if (id is null) { return(NotFound()); } League = await _leagueRepository.GetLeagueAsync(id.Value); if (League is null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> Details(int?id) { if (id is null) { return(NotFound()); } var league = await _leagueRepository.GetLeagueAsync(id.Value); if (league is null) { return(NotFound()); } _leaguesDetailsViewModel.League = league; return(View(_leaguesDetailsViewModel)); }
public async Task <ActionResult <LeagueModel> > GetLeague(int id) { try { var league = await _leagueRepository.GetLeagueAsync(id); if (league is null) { return(NotFound()); } return(_mapper.Map <LeagueModel>(league)); } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError, Settings.DatabaseFailureString)); } }