Beispiel #1
0
 public MenuController(IDispatcher dispatcher,
                       IMenuRules menuRules,
                       IContextService contextService)
     : base(contextService)
 {
     _dispatcher = dispatcher;
     _menuRules  = menuRules;
 }
 public MenuController(ICommandSender commandSender,
                       IQueryDispatcher queryDispatcher,
                       IMenuRules menuRules,
                       IContextService contextService)
     : base(contextService)
 {
     _commandSender   = commandSender;
     _queryDispatcher = queryDispatcher;
     _menuRules       = menuRules;
 }
Beispiel #3
0
 public MenuController(IMenuFacade menuFacade,
                       ICommandSender commandSender,
                       IMenuRules menuRules,
                       IContextService contextService)
     : base(contextService)
 {
     _menuFacade    = menuFacade;
     _commandSender = commandSender;
     _menuRules     = menuRules;
 }
        public CreateMenuValidator(IMenuRules menuRules, ISiteRules siteRules)
            : base(siteRules)
        {
            _menuRules = menuRules;

            RuleFor(c => c.Id)
            .Must(HaveUniqueId).WithMessage("A menu with the same id already exists.")
            .When(x => x.Id != Guid.Empty);

            RuleFor(c => c.Name)
            .NotEmpty().WithMessage("Menu name is required.")
            .Length(3, 100).WithMessage("Menu name length must be between 3 and 100 characters.")
            .Must(HaveValidName).WithMessage("Menu name is not valid. Enter only letters, numbers, underscores and hyphens.")
            .Must(HaveUniqueName).WithMessage("A menu with the same name already exists.");
        }