public ValidationResponse Add(Person entity)
        {
            var validation = new ValidationPerson(entity, _Persons);

            validation.Validate();

            if (validation.ValidationResult.IsValid)
            {
                _Persons.Add(entity);
            }

            return(validation.ValidationResult);
        }
예제 #2
0
        public ResponseModel <PersonModel> Add(PersonModel entity)
        {
            var validation = new ValidationPerson(entity, Persons);

            validation.Validate();

            if (validation.ValidationResult.IsValid)
            {
                Persons.Add(entity);
            }

            return(new ResponseModel <PersonModel> {
                Model = entity, Validation = validation.ValidationResult
            });
        }