コード例 #1
0
        public static IValidationRuleBuilderForProperty <TForModel, int> Range <TForModel>(
            this IValidationRuleBuilderForProperty <TForModel, int> context, int from, int to)
        {
            context.AddRule(new MinValidationRule(from));
            context.AddRule(new MaxValidationRule(to));

            return(context);
        }
コード例 #2
0
        public static IValidationRuleBuilderForProperty <TForModel, string> Length <TForModel>(
            this IValidationRuleBuilderForProperty <TForModel, string> context, int min, int max)
        {
            context.AddRule(new MinLengthValidationRule(min));
            context.AddRule(new MaxLengthValidationRule(max));

            return(context);
        }
コード例 #3
0
        public static IValidationRuleBuilderForProperty <TForModel, int> Min <TForModel>(
            this IValidationRuleBuilderForProperty <TForModel, int> context, int min)
        {
            context.AddRule(new MinValidationRule(min));

            return(context);
        }
コード例 #4
0
        public static IValidationRuleBuilderForProperty <TForModel, int> Max <TForModel>(
            this IValidationRuleBuilderForProperty <TForModel, int> context, int max)
        {
            context.AddRule(new MaxValidationRule(max));

            return(context);
        }
コード例 #5
0
        public static IValidationRuleBuilderForProperty <TForModel, string> Required <TForModel>(
            this IValidationRuleBuilderForProperty <TForModel, string> context)
        {
            context.AddRule(new MinLengthValidationRule(1));

            return(context);
        }