Example #1
0
        public async Task <ActionResult> DeletePokemon(int pokedexEntry, int generation = -1)
        {
            try{
                if (generation > 0)
                {
                    await _pokemonService.DeletePokemon_ByEntryAndGen(pokedexEntry, generation);

                    _logger.LogInformation($"Pokemons were removed - PokedexEntry:{pokedexEntry} - Generation{generation}");
                    return(new OkResult());
                }
                else
                {
                    await _pokemonService.DeletePokemon_ByEntry(pokedexEntry);

                    _logger.LogInformation($"Pokemons were removed - PokedexEntry:{pokedexEntry}");
                    return(new OkResult());
                }
            }
            catch (Exception ex) {
                _logger.LogWarning($"Warning {ex.Message}");
                return(new StatusCodeResult(500));
            }
        }