public Pet Insert(Pet pet) { if (ValidatePet(pet)) { return(pet); } SetDefaultInfo(pet); return(_petShopRepository.Insert(pet)); }
public Pet Insert(Pet pet) { var petValidator = new PetValidator(); pet.ValidationResult = petValidator.Validate(pet); if (pet.ValidationResult.Errors.Any()) { return(pet); } return(_petShopRepository.Insert(pet)); }