Beispiel #1
0
 private void Validate( IValidationWithAttributes contextInterface, string propertyName, object propertyValue, ValidationAttribute[] attributes )
 {
     var errors = attributes.Select( x => x.GetValidationError( propertyValue ))
                            .Where( x=>x != null );
     if (!errors.Any())
     {
         contextInterface.RemoveErrors( propertyName );
     }
     else
     {
         contextInterface.SetErrors( propertyName, errors );
     }
 }
Beispiel #2
0
        private void Validate(IValidationWithAttributes contextInterface, string propertyName, object propertyValue, ValidationAttribute[] attributes)
        {
            var errors = attributes.Select(x => x.GetValidationError(propertyValue))
                         .Where(x => x != null);

            if (!errors.Any())
            {
                contextInterface.RemoveErrors(propertyName);
            }
            else
            {
                contextInterface.SetErrors(propertyName, errors);
            }
        }