public static Validation IsNotNull(this Validation validation, decimal theObject, string paramName) { return(theObject == 0 ? validation.AddException(ValidationException.IsRequired(paramName)) : validation); }
public static Validation IsNotNull(this Validation validation, DateTime theObject, string paramName) { return(Equals(theObject, DateTime.MinValue) ? validation.AddException(ValidationException.IsRequired(paramName)) : validation); }
public static Validation IsNotNull <T>(this Validation validation, T theObject, string paramName) where T : class { return(theObject == null?validation.AddException(ValidationException.IsRequired(paramName)) : validation); }
public static Validation IsFalse(this Validation validation, bool?val, string message) { return(val.HasValue && val.Value == false? validation : validation.AddException(new ValidationException(message))); }
public static Validation IsTrue(this Validation validation, bool val, string message) { return(val ? validation : validation.AddException(new ValidationException(message))); }
public static Validation IsEqual <T>(this Validation validation, T left, T right, string message) { return(Equals(left, right) ? validation : validation.AddException(new ValidationException(message))); }
public static bool IsValid(this Validation validation) { return(validation?.Errors == null || !validation.Errors.Any()); }