Exemplo n.º 1
0
        protected virtual async Task CreateAsync(CreateOrEditInput input)
        {
            var menuItemDefine = new MenuItemDefine();

            menuItemDefine.ParentMenuId = input.PId;
            menuItemDefine.DisplayName  = input.Name;
            menuItemDefine.Order        = 1;
            menuItemDefine.Name         = Pinyin.GetPinyin(menuItemDefine.DisplayName);
            await _menuRepository.InsertAsync(menuItemDefine);

            await CurrentUnitOfWork.SaveChangesAsync();
        }
Exemplo n.º 2
0
        protected virtual async Task CreateAsync(CreateOrEditInput input)
        {
            var menuItemDefine = new MenuItemDefine();

            menuItemDefine.MenuGuid       = Guid.NewGuid().ToString();
            menuItemDefine.ParentMenuGuid = input.PId;
            menuItemDefine.DisplayName    = input.Name;
            menuItemDefine.Order          = 1;
            menuItemDefine.Name           = _converter.Converter(menuItemDefine.DisplayName);
            await _menuRepository.InsertAsync(menuItemDefine);

            await CurrentUnitOfWork.SaveChangesAsync();
        }
Exemplo n.º 3
0
        private void BuildTree(MenuItemDefinition menuItem, MenuItemDefine item, List <MenuItemDefine> data)
        {
            //找当前项的子项
            var subMenuList = data.FindAll(c => c.ParentMenuGuid == item.MenuGuid).OrderBy(c => c.Order).ToList();

            foreach (var subItem in subMenuList)
            {
                var subMenuItem = new MenuItemDefinition(
                    subItem.Name,
                    L(subItem.DisplayName),
                    url: subItem.Url + "/index?menuGuid=" + subItem.MenuGuid,
                    icon: subItem.Icon
                    );
                menuItem.AddItem(subMenuItem);
                BuildTree(subMenuItem, subItem, subMenuList);
            }
        }