Exemplo n.º 1
0
        public Pet Insert(Pet pet)
        {
            if (ValidatePet(pet))
            {
                return(pet);
            }

            SetDefaultInfo(pet);
            return(_petShopRepository.Insert(pet));
        }
Exemplo n.º 2
0
        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));
        }