public PartialViewResult Left(string currentPageName = "", int menuId = 0) { //左边导航菜单 var leftModel = new LeftViewModel(); MenuListDto m = _menuAppService.GetMenuById(new EntityDto <long> { Id = menuId }); leftModel.MenuParentName = m.MenuName; leftModel.Menu = _menuAppService.GetMenusByParentId(menuId); leftModel.CurrentPageName = currentPageName; return(PartialView("~/Areas/Admin/Views/Layout/_Left.cshtml", leftModel)); }
public async Task <int> SaveMenuListAsync(MenuListDto menuListDto) { var AutoIdx = new SqlParameter("@mId", menuListDto.AutoIdx); var Name = new SqlParameter("@mName", menuListDto.MenuName.Trim()); var Description = new SqlParameter("@mDescription", menuListDto.MenuDescription.Trim()); var Type = new SqlParameter("@mType", menuListDto.mType.Trim()); var GroupName = new SqlParameter("@GroupName", menuListDto.GroupName.Trim()); var AgentLevel = new SqlParameter("@AgentLevel", menuListDto.AgentLevelId); var AgentId = new SqlParameter("@AgentId", menuListDto.AgentId); var Result = new SqlParameter("@Result", SqlDbType.Int); Result.Direction = ParameterDirection.Output; // Description.SqlDbType = SqlDbType.VarChar; await _context.Database .ExecuteSqlCommandAsync(@"exec spMenuListSave @mId,@mName,@mDescription,@mType ,@GroupName,@AgentId,@AgentLevel,@Result out" , AutoIdx, Name, Description, Type, GroupName, AgentId, AgentLevel, Result); return(int.Parse(Result.Value.ToString())); }
/// <summary> /// 菜单节点 /// </summary> /// <param name="parentId">父节点</param> /// <returns></returns> private List <MenuListDto> SortMenuForTree(int parentId, IList <MenuDto> rolePermissions) { var model = new List <MenuListDto>(); if (rolePermissions != null) { foreach (var p in rolePermissions.Where(t => t.ParentID == parentId) .OrderBy(t => t.OrderNum)) { var menu = new MenuListDto { MenuID = p.MenuID, MenuName = p.MenuName, MenuUrl = p.MenuUrl, MenuIcon = p.MenuIcon }; menu.Children.AddRange(SortMenuForTree(p.MenuID, rolePermissions)); model.Add(menu); } } return(model); }
public List <MenuListDto> getMenus(string dni, int schoolID) { Teacher teacher = new Teacher(); teacher = this.teacherRepository.GetByDni(dni, schoolID); int roleID = teacher.roleID; bool active = true; List <RoleInActionListDto> actionsxRole = this.roleInActionRepository.GetByroleIDByschoolIDByactive(roleID, schoolID, active); IEnumerable <String> menusString = actionsxRole.Select(x => x.menu_name).Distinct(); //IEnumerable<String> iconsString = actionsxRole.Select(x => x.menu_description).Distinct(); List <MenuListDto> menus = new List <MenuListDto>(); foreach (String menu in menusString) { MenuListDto menuDto = new MenuListDto(); menuDto.name = menu;; string icon = ""; RoleInActionListDto obj = new RoleInActionListDto(); obj = actionsxRole.Where(x => x.menu_name == menu).FirstOrDefault(); if (obj != null) { icon = obj.menu_description; } menuDto.description = icon; menuDto.actions = actionsxRole.Where(e => e.menu_name == menu).ToList(); menus.Add(menuDto); } return(menus); }
public List <MenuListDto> GetMenus(GuidRequest guidRequest) { List <MenuListDto> menuTitleList = new List <MenuListDto>(); var list = menuRepository .FindAll(x => x.RestaurantGuid == guidRequest.Guid) .OrderBy(x => x.Type) .GroupBy(x => x.Type); if (list == null) { throw new Exception("Menu bulunamadı"); } list.ToList().ForEach(r => { MenuListDto menuList = new MenuListDto(); menuList.MenuList = new List <MenuDto>(); foreach (var v in r) { menuList.Title = v.Type.GetDescription(); menuList.MenuList.Add(new MenuDto { Amount = v.Amount, RestaurantGuid = v.RestaurantGuid, Count = v.Count, Description = v.Description, Guid = v.Guid, Logo = v.Logo, Name = v.Name, Type = (int)v.Type }); } menuTitleList.Add(menuList); }); return(menuTitleList); }
public async Task <IActionResult> SaveMenuList(MenuListDto menuListDto) { var result = await _masterRepository.SaveMenuListAsync(menuListDto); return(Ok(result)); }