예제 #1
0
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            var validator = new NewsViewModelValidator();
            var result    = validator.Validate(this);

            return(result.Errors.Select(item => new ValidationResult(item.ErrorMessage, new[] { item.PropertyName })));
        }
예제 #2
0
 public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
 {
     var validator = new NewsViewModelValidator();
     var result = validator.Validate(this);
     return result.Errors.Select(item => new ValidationResult(item.ErrorMessage, new[] { item.PropertyName }));
 }