public RoleCreateFormValidator( IRoleStore roleStore, IResourceStore resourceStore, ICodeRule codeRule, IDescriptionRule descriptionRule, IDisplayNameRule displayNameRule) { this.RoleStore = roleStore; this.ResourceStore = resourceStore; RuleFor(x => x.Code) .NotEmpty() .ApplyRule(codeRule) .MustAsync(NotBeExistingCodeAsync) .WithMessage("Already existing"); RuleFor(x => x.Name) .NotEmpty() .ApplyRule(displayNameRule); RuleFor(x => x.Description) .ApplyRule(descriptionRule); RuleFor(x => x.Permissions) .Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty() .MustAsync(BeExistingResourceCodes) .WithMessage("Unexisting resource code detected."); }
public ResourcesController( IResourceStore resourceStore, ICodeRule codeRule, IDescriptionRule descriptionRule) { this.ResourceStore = resourceStore; this.CodeRule = codeRule; this.DescriptionRule = descriptionRule; }
public ResourceUpdateFormValidator( ICodeRule codeRule, IDescriptionRule descriptionRule) { RuleFor(x => x.Category) .ApplyRule(codeRule); RuleFor(x => x.Description) .ApplyRule(descriptionRule); }
public RolesController( IRoleStore roleStore, IResourceStore resourceStore, ICodeRule codeRule, IDescriptionRule descriptionRule, IDisplayNameRule displayNameRule) { this.RoleStore = roleStore; this.ResourceStore = resourceStore; this.CodeRule = codeRule; this.DescriptionRule = descriptionRule; this.DisplayNameRule = displayNameRule; }
public ResourceValidator( ICodeRule codeRule, IDescriptionRule descriptionRule) { RuleFor(x => x.Code) .NotEmpty() .ApplyRule(codeRule); RuleFor(x => x.Category) .NotEmpty() .ApplyRule(codeRule); RuleFor(x => x.Description) .ApplyRule(descriptionRule); }
public RoleValidator( IResourceStore resourceStore, ICodeRule codeRule, IDisplayNameRule displayNameRule, IDescriptionRule descriptionRule) { this.ResourceStore = resourceStore; RuleFor(x => x.Code) .NotEmpty() .ApplyRule(codeRule); RuleFor(x => x.DisplayName) .NotEmpty() .ApplyRule(displayNameRule); RuleFor(x => x.Description) .ApplyRule(descriptionRule); RuleFor(x => x.Permissions) .NotEmpty() .Must(BeUniquePermissionPerResource) .MustAsync(BeExistingResourceCodes); }