public Pet DeletePet(int id) { if (_petRepository.DeletePet(id) == null) { throw new InvalidDataException("No pet with id: " + id + " exist"); } return(_petRepository.DeletePet(id)); }
public Pet DeletePet(int id) { /*if (!IdVerifier(id)) * { * throw new InvalidDataException($"The Id you entered does NOT exist"); * }*/ return(_petRepo.DeletePet(id)); }
public Pet Delete(Pet petToDelete) { if (petToDelete != null) { return(_petRepository.DeletePet(petToDelete.Id)); } throw new InvalidDataException($"The pet you are trying to delete does not exist!"); }
public Pet DeletePet(int id) { if (id < 1) { throw new InvalidDataException("ID cannot be lower than 1"); } return(_petRepository.DeletePet(id)); }
public bool RemovePet(int id) { if (!_petRepo.DeletePet(id)) { throw new Exception("The pet hasn't been removed!"); } return(true); }
public ActionResult Delete(Guid id) { if (id != Guid.Empty) { _petRepository.DeletePet(id); return(RedirectToAction("Index")); } throw new HttpException(404, "Pet Not Found"); }
public Pet DeletePetByID(int theId) { List <Pet> toBeDeletedPets = _petRepo.FindPetByID(theId); if (toBeDeletedPets.Count != 1 || toBeDeletedPets[0] == null) { throw new InvalidDataException(message: "Could not find that pet Id to delete."); } return(_petRepo.DeletePet(toBeDeletedPets[0])); }
public void DeletePetById(int id) { var pet = GetPetById(id); if (pet == null) { throw new ArgumentException("No pet with this id"); } _PetRepo.DeletePet(pet); }
public async Task <ActionResult <PetViewModel> > DeletePet(int id) { Pet pet = await _petRepository.DeletePet(id); if (pet == null) { return(NotFound()); } return(_mapper.Map <PetViewModel>(pet)); }
public void DeletePet(int id) { try { _petRepository.DeletePet(id); } catch (Exception e) { throw e; } }
public Pet DeletePet(int id) { servicePetLst = _petRepo.GetAllPets(); if (id == 0) { throw new Exception("Invalid ID"); } Pet petForOwnerID = _petRepo.ReadPetById(id); return(_petRepo.DeletePet(id)); }
public bool DeletePet(int Id) { if (Id > -1) { return(_petRepository.DeletePet(Id)); } else { throw new InvalidDataException("Id must be greater or equal to zero"); } }
public IActionResult Delete(Pet pet) { Pet deletedPet = repository.DeletePet(pet); if (deletedPet != null) { TempData["message"] = $"Usunięto {deletedPet.Name}."; } return(RedirectToAction("Index")); }
public override async Task <ActionResult <Pet> > DeletePet(int id, CancellationToken cancellationToken) { Core.Pet pet = await _petRepository.DeletePet(id); if (pet == null) { return(NotFound()); } return(_mapper.Map <Pet>(pet)); }
public Pet DeletePet(int ID) { if (ID <= 0) { throw new ArgumentException("Incorrect ID entered"); } if (GetPetByID(ID) == null) { throw new ArgumentException("No pet with such ID found"); } return(PetRepository.DeletePet(ID)); }
public Pet DeletePet(int id) { Pet petToDelete; if (!_petRepository.GetAllPets().Exists(x => x.PetId == id)) { throw new KeyNotFoundException("A pet with this ID does not exist"); } petToDelete = _petRepository.GetAllPets().Find(x => x.PetId == id); return(_petRepository.DeletePet(petToDelete)); }
public void DeletePet(int id) { _log.Info($"DeletePet, id: {id}"); try { _repository.DeletePet(id); } catch (Exception e) { _log.Error($"Failure to delete pet: {id}", e); throw; } }
public async Task <ActionResult> DeletePet(Guid petId) { var petFromRepo = await _petRepository.GetPetAsync(petId); if (petFromRepo == null) { return(NotFound()); } _petRepository.DeletePet(petFromRepo); await _petRepository.SaveAsync(); return(NoContent()); }
public Pet DeletePet(int id) { Pet petToDelete; if (!_petRepository.ReadPets().Exists(x => x.ID == id)) { throw new InvalidDataException("A pet with this ID does not exist"); } else { petToDelete = _petRepository.ReadPets().Find(x => x.ID == id); return(_petRepository.DeletePet(petToDelete)); } }
public ICommandResult handle(CommandDeletePet command) { command.Validate(); if (command.Invalid) { return(new CommandResult("Command Invalid delete a Pet", false, command)); } var pet = _petRepository.GetPetById(command.Id); _petRepository.DeletePet(pet); return(new CommandResult("Pet Deleted", true, command)); }
public Pet DeletePet(int id) { if (id <= 0) { throw new InvalidDataException("ID can not be 0 or lower"); } var pet = petRepository.GetPetByID(id); if (pet == null) { throw new ArgumentNullException("Pet Could not be found"); } petRepository.DeletePet(petRepository.GetPetByID(id)); return(pet); }
public void DeletePet(int id) { _repository.DeletePet(id); }
public void DeletePet(int id) { _petRepo.DeletePet(id); }
public bool DeletePet(int id) { return(_petRepo.DeletePet(id)); }
public bool DeletePet(int petId) { return(petRepository.DeletePet(petId)); }
/// <summary> /// Delete a pet /// </summary> /// <param name="Petid"></param> /// <returns></returns> public Pet DeletePet(int Petid) { return(_petRepo.DeletePet(Petid)); }
public Pet DeletePet(int petId) { return(_petRepository.DeletePet(petId)); }
public void DeletePet(int Id) { _petRepository.DeletePet(Id); }
public Pet DeletePet(Pet pet) { return(_petRepo.DeletePet(pet)); }
public Pet DeletePet(int id) { var deletePet = _petRepository.ReadById(id); return(_petRepository.DeletePet(deletePet)); }