コード例 #1
0
        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());
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
            }
        }