Example #1
0
 public static IRuleBuilderOptions <T, string> OptionalUrl <T>(this IRuleBuilderInitial <T, string> propertyRule)
 {
     return(propertyRule
            .Length(0, UrlMaxLength)
            .Must(IsValidUrl)
            .When(x => !string.IsNullOrEmpty(x as string))
            .WithMessage(InvalidUrlMessage));
 }
Example #2
0
 public static IRuleBuilderOptions <T, string> OptionalSummary <T>(this IRuleBuilderInitial <T, string> propertyRule)
 {
     return(propertyRule
            .Length(0, SummaryMaxLength));
 }
Example #3
0
 public static IRuleBuilderOptions <T, string> OptionalContent <T>(this IRuleBuilderInitial <T, string> propertyRule)
 {
     return(propertyRule
            .Length(0, ContentMaxLength));
 }
Example #4
0
 public static IRuleBuilderOptions <T, string> OptionalDescription <T>(this IRuleBuilderInitial <T, string> propertyRule)
 {
     return(propertyRule
            .Length(0, DescriptionMaxLength));
 }