public async Task <ActionResult <IEnumerable <Pokemon> > > GetAllAsync() { var entities = default(IEnumerable <Pokemon>); try { entities = await _repository.GetAllAsync().ConfigureAwait(false); } catch (Exception ex) { var baseMsg = $"Error searching Pokemon."; _logger.LogError(ex, $"{baseMsg} Check the log for details."); } if (entities == null) { entities = new List <Pokemon>(); } return(Ok(entities)); }
public async Task <List <PokemonModelDTO> > GetAllPokemonsAsync() { var pokemonList = await _pokemonRepository.GetAllAsync(); return(pokemonList.Select(x => _mapper.Map <PokemonModelDTO>(x)).ToList()); }