Пример #1
0
            public static void AddValidation(AbstractValidator <Command> v)
            {
                v.RuleFor(x => x.Name)
                .NotEmpty().WithMessage("Please enter name.");

                v.RuleFor(x => x.Gender)
                .Equal(0).WithMessage("Invalid gender.");

                v.RuleForEach(x => x.Locales).ChildRules(locales =>
                {
                    locales.RuleFor(x => x.Name)
                    .NotEmpty().WithMessage("Please enter name.");
                });
            }