public ValidationResponse Add(Person entity) { var validation = new ValidationPerson(entity, _Persons); validation.Validate(); if (validation.ValidationResult.IsValid) { _Persons.Add(entity); } return(validation.ValidationResult); }
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 }); }