private static Expression <Func <string, int, ValidateResult> > Func(int minValue) => (name, value) => value.ToString().Length < minValue
     ? ValidateResult.Error($"Value if {name} should be great then {minValue}")
     : ValidateResult.OK();
Exemple #2
0
 public static ValidateResult ValidateNameRequired(string name, string value) => string.IsNullOrWhiteSpace(value) ? ValidateResult.Error($"missing {name}") : ValidateResult.OK();
Exemple #3
0
 public static ValidateResult ValidateNameMinLength(string name, string value, int minlength) => value.Length < minlength?ValidateResult.Error($"length of {name} should be great than {minlength}") : ValidateResult.OK();
 private static Expression <Func <string, string, ValidateResult> > Func(int MaxLength) => (name, value) => value.Length > MaxLength
     ? ValidateResult.Error($"Length if {name} should be less than {MaxLength}")
     : ValidateResult.OK();