public bool isValid(Toner entity) { var validator = new TonerValidator(); var result = validator.Validate(entity); return(result.IsValid); }
public IList <ErrorMessage> Errors(Toner entity) { var validator = new TonerValidator(); 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); }