Esempio n. 1
0
        public async Task <ActionResult <Mode> > GetMode(Guid id)
        {
            var mode = await _modeService.GetModeByIdAsync(id);

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

            return(mode);
        }
Esempio n. 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);
        }
Esempio n. 3
0
        public async Task <IActionResult> OnGet(Guid id)
        {
            if (id == null)
            {
                return(BadRequest());
            }

            Mode = await _modeService.GetModeByIdAsync(id);

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

            return(Page());
        }