public IActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index"));
            }

            _repository.Delete(id.Value);
            return(RedirectToAction("Index"));
        }
 private void DeletePokemon()
 {
     int id = io.PromptUserForInt("Enter Id to remove");
     repo.Delete(id);
     Pokemon deletedInfo = repo.ReadById(io.PromptUserForInt("Enter Id for pokemon"));
     if (deletedInfo == null)
     {
         Console.WriteLine("No pokemon found");
     }
 }
        public bool Delete(int pokemonId, int idUserLogged)
        {
            var pokemon = _pokemonRepository.GetById <Pokemons>(pokemonId);

            if (pokemon.Id_User != idUserLogged)
            {
                throw new DomainException("This pokemon belongs to someone else!");
            }
            _pokemonRepository.Delete(pokemon);
            return(true);
        }
Exemple #4
0
 public void Delete(long id)
 {
     pokemonRepository.Delete(id);
 }
Exemple #5
0
 public void DeletePokemon(int id)
 {
     _pokemonRepository.Delete(id);
 }
 public IActionResult Delete(int id)
 {
     _repository.Delete(id);
     return(Ok());
 }