public IActionResult GetMenuTreeData()
        {
            var menus = _menuAppService.GetAllList();
            List <TreeModel> treeModels = new List <TreeModel>();

            foreach (var menu in menus)
            {
                treeModels.Add(new TreeModel()
                {
                    Id = menu.Id.ToString(), Text = menu.Name, Parent = menu.ParentId == Guid.Empty ? "#" : menu.ParentId.ToString()
                });
            }
            return(Json(treeModels));
        }
        public IViewComponentResult Invoke()
        {
            var userId = HttpContext.Session.GetString("CurrentUserId");
            //var menus = _menuAppService.GetMenusByUser(Guid.Parse(userId));
            var menus = _menuAppService.GetAllList();

            return(View(menus));
        }
Esempio n. 3
0
        public IActionResult GetMenuTreeData()
        {
            var Res = new ServiceResultList <List <MenuDto> >();

            try
            {
                Res.IsSuccess();
                Res.Data = _menuAppService.GetAllList();
            }
            catch (Exception)
            {
                Res.IsFailed();
            }

            return(Ok(Res));
        }
Esempio n. 4
0
        public IActionResult GetMenuTreeData(Guid id)
        {
            var menus     = _menuAppService.GetAllList();
            var roleMenus = _service.GetRoleMenus(id);
            List <TreeCheckBoxModel> treeModels = new List <TreeCheckBoxModel>();

            menus.ForEach((menu) =>
            {
                RoleMenuDto tempt = roleMenus.Find((roleMenu) => menu.Id == roleMenu.MenuId);
                treeModels.Add(new TreeCheckBoxModel()
                {
                    Id = menu.Id.ToString(), Text = menu.Name, Parent = menu.ParentId == Guid.Empty ? "#" : menu.ParentId.ToString(), Checked = tempt != null?"1":"0"
                });
            });

            return(Ok(treeModels));
        }
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var menus = await _menuAppService.GetAllList(it => it.Type == 0);

            return(View(_menuAppService.ConvertL2T(menus, Request.Path)));
        }