public ValidationMessage Validate(FieldMetadata metaData, Field field)
 {
     if (field.Value != "Yahoo")
     {
         var message = string.Format("Domain is not Valid");
         return(new ValidationMessage(false, message));
     }
     return(new ValidationMessage());
 }
Beispiel #2
0
 public ValidationMessage Validate(FieldMetadata metaData, Field field)
 {
     if (string.IsNullOrEmpty(field.Value))
     {
         var message = string.Format("Field {0} cannot be empty", metaData.Name);
         return(new ValidationMessage(false, message));
     }
     return(new ValidationMessage());
 }
 void AssociateValdatorsToField(FieldMetadata metadata)
 {
     metadata.Attributes.ForEach(o =>
     {
         var validator = GetValidatorForAttribute(o);
         if (validator != null)
         {
             metadata.Validators.Add(validator);
         }
     });
 }