public async Task <IEnumerable <Pokemon> > GetAll()
        {
            string baseURL  = configuration["BaseURL:PokeAPIv2:URL"];
            string endpoint = configuration["BaseURL:PokeAPIv2:Endpoint:Pokemon"];

            IEnumerable <Pokemon> pokemons = await servicePokemon.GetAllAsync(baseURL, endpoint);

            return(pokemons);
        }
Example #2
0
        public async Task <IActionResult> GetAllAsync()
        {
            try
            {
                var result = await PokemonService.GetAllAsync();

                if (result == null || !result.Any())
                {
                    return(NotFound());
                }
                return(Ok(result));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
 public async Task <DataCollection <Pokemon> > GetAll(int page = 1, int take = 10)
 {
     return(await _pokemonService.GetAllAsync(page, take));
 }