Example #1
0
        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));
        }
Example #2
0
 public Pet FindPetById(int id)
 {
     return(_petShopRepo.FindPetById(id));
 }