public Owner CreateOwner(Owner owner) { if (owner.OwnedPet == null || owner.OwnedPet.Id <= 0) { throw new InvalidDataException("To create an Owner you need a Pet"); } if (_petshoprepository.FindPetById(owner.OwnedPet.Id) == null) { throw new InvalidDataException("Pet not found"); } if (owner.Name == null) { throw new InvalidDataException("Owner needs a name"); } return(_ownerRepository.AddOwner(owner)); }
public Pet FindPetById(int id) { return(_petShopRepo.FindPetById(id)); }