public ResourceAddValidator() { RuleFor(x => x.Name).MustHasValue("资源名称"); RuleFor(x => x.ParentId).MustHasValue("父节点Id"); RuleFor(x => x.Alias).MustHasValue("别名").Must(a => H_Validator.IsLetter(a)).WithMessage("别名只能输入英文"); }
public ResourceUpdateValidator() { RuleFor(x => x.Name).MustHasValue("资源名称"); RuleFor(x => x.Sort).MustHasValue("排序值"); RuleFor(x => x.Alias).MustHasValue("别名").Must(a => H_Validator.IsLetter(a)).WithMessage("别名只能输入英文"); }
public ModuleUpdateValidator() { RuleFor(x => x.Name).MustHasValue("模块名称"); RuleFor(x => x.Type).MustHasValue("模块类型"); RuleFor(x => x.Icon).MustHasValue("模块图标").When(a => a.Type == ModuleType.Main); RuleFor(x => x.RouterUrl).MustHasValue("子应用路由地址").When(a => a.Type == ModuleType.Sub); RuleFor(x => x.Sort).MustHasValue("排序值"); RuleFor(x => x.Alias).MustHasValue("别名").Must(a => H_Validator.IsLetter(a)).WithMessage("别名只能输入英文"); }
public UserAddValidator() { RuleFor(x => x.Account).MustHasValue("账号").Must(a => H_Validator.IsLetterOrDigit(a)).WithMessage("只能输入英文或者数字"); RuleFor(x => x.Password).MustFixedLength("密码", 6, 16); RuleFor(x => x.Name).MustHasValue("姓名"); RuleFor(x => x.Gender).EnumMustHasValue("性别"); RuleFor(x => x.Birthday).MustHasValue("出生日期"); RuleFor(x => x.Phone).MustHasValue("手机"); RuleFor(x => x.RoleId).MustHasValue("角色Id"); //RuleFor(x => x.Data).SetCollectionValidator(new BoxOrderItemVMValidator()); // 集合子项数据验证 }
public CurrentUserUpdateValidator() { RuleFor(x => x.Phone).MustHasValue("手机").Must(x => H_Validator.IsMobile(x)).WithMessage("手机号格式有误"); }