コード例 #1
0
ファイル: MenuService.cs プロジェクト: lzw5399/dl-admin
        /// <summary>获取当前用户拥有的角色,所对应的权限路由</summary>
        public async Task <List <RouterDto> > GetMenuRouterList(int userid)
        {
            var user = await _userService.GetById(userid);

            if (user == null)
            {
                throw new UserNotFoundException();
            }

            if (string.IsNullOrEmpty(user.Roleid))
            {
                return(new List <RouterDto>());
            }

            var ids      = user.Roleid.Split(',').Select(id => int.Parse(id)).ToList();
            var topMenus = await _unitOfWork.MenuRepository.GetTopLevelMenusByRoleIds(ids);

            var dtos = new List <RouterDto>();

            foreach (var topMenu in topMenus)
            {
                var subMenus = await _unitOfWork.MenuRepository.GetSubMenusByParentCode(topMenu.Code);

                var dto = MenuMapper.ToRouterDto(topMenu, subMenus);

                dtos.Add(dto);
            }

            dtos = dtos.OrderBy(it => it.Num).ToList();

            return(dtos);
        }
コード例 #2
0
ファイル: MenuAppService.cs プロジェクト: mvfavila/Dafa
        public IEnumerable <MenuItemViewModel> GetByClaims(List <Tuple <string, string> > claims)
        {
            var menu = menuService.GetAll()
                       .Where(m => claims.Any(t => t.Item1 == m.ClaimType && t.Item2 == m.ClaimValue));

            return(MenuMapper.FromDomainToViewModel(menu));
        }
コード例 #3
0
        public MenuController()
        {
            this._menuRepository = new MenuRepository();
            this._menuItemRepository = new MenuItemRepository();

            this._menuMapper = new MenuMapper();
            this._menuItemMapper = new MenuItemMapper();
        }
コード例 #4
0
ファイル: Startup.cs プロジェクト: w3cboss/efcore
        public Startup(IHostingEnvironment env)
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(env.ContentRootPath)
                          .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                          .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
                          .AddEnvironmentVariables();

            Configuration = builder.Build();

            MenuMapper.Initialize();
        }
コード例 #5
0
ファイル: NavNode.cs プロジェクト: upallnightcoding/Clyde
        /*************************/
        /*** Private Functions ***/
        /*************************/

        /// <summary>
        /// CreateTreeNode() -
        /// </summary>
        /// <returns></returns>
        public TreeNode CreateTreeNode()
        {
            TreeNode newNode = new TreeNode(NodeName());

            if (CreateAMenu())
            {
                ContextMenuStrip contextMenu = new ContextMenuStrip();

                menuMapper = new MenuMapper(contextMenu);

                newNode.ContextMenuStrip = contextMenu;

                CreateMenuOptions();
            }

            return(newNode);
        }
コード例 #6
0
        public ActionResult AddBurger(string custName, int tableID, int bunID, int meatID, int cheeseID)
        {
            IngridientModel Bun  = new IngMapper().GetIngridient(bunID);
            IngridientModel Meat = new IngMapper().GetIngridient(meatID);

            MenuModel Menu = new MenuModel
            {
                CustName = custName,
                TableID  = tableID,
                Bun      = Bun,
                Meat     = Meat
            };

            if (cheeseID != 0)
            {
                Menu.Cheese = new IngMapper().GetIngridient(cheeseID);
            }

            MenuMapper mapper = new MenuMapper();

            mapper.CreateNewBurger(Menu);

            return(this.RedirectToAction("Index", "Burger"));
        }
コード例 #7
0
ファイル: MenuManager.cs プロジェクト: upallnightcoding/Clyde
        /*******************/
        /*** Constructor ***/
        /*******************/

        public MenuManager(MenuStrip menuStrip)
        {
            this.menuMapper = new MenuMapper(menuStrip);
        }