Beispiel #1
0
        public async Task <ActionResult <Genre> > GetGenre(Guid id)
        {
            var genre = await _genreService.GetGenreByIdAsync(id);

            if (genre == null)
            {
                return(NotFound());
            }

            return(genre);
        }
Beispiel #2
0
        public async Task <Game> GetGameByIdAsync(Guid id)
        {
            var response = await _httpClient.GetAsync($"{_baseAdress}/games/{id}");

            if (response.IsSuccessStatusCode)
            {
                var game = JsonConvert.DeserializeObject <Game>(await response.Content.ReadAsStringAsync());

                game.Genre = await _genreService.GetGenreByIdAsync(game.GenreId);

                game.Mode = await _modeService.GetModeByIdAsync(game.ModeId);

                game.Platform = await _platformService.GetPlatformByIdAsync(game.PlatformId);

                game.Category = await _categoryService.GetCategoryByIdAsync(game.CategoryId);

                return(game);
            }

            return(null);
        }
        public async Task <IActionResult> OnGet(Guid id)
        {
            if (id == null)
            {
                return(BadRequest());
            }

            Genre = await _genreService.GetGenreByIdAsync(id);

            if (Genre == null)
            {
                return(NotFound());
            }

            return(Page());
        }