public bool isValid(Visit entity) { var validator = new VisitValidator(); var result = validator.Validate(entity); return(result.IsValid); }
public IList <ErrorMessage> Errors(Visit entity) { var validator = new VisitValidator(); var result = validator.Validate(entity); var errors = new List <ErrorMessage>(); foreach (var item in result.Errors) { errors.Add(new ErrorMessage { Key = item.PropertyName, Error = item.ErrorMessage }); } return(errors); }