コード例 #1
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <JsonResponse> Create(MenuRequestDto input)
        {
            input.InitCreateRequest();
            var resJson = await _applicationEnginee.TryTransactionAsync(async() =>
            {
                await _menuAppService.CreateAsync(input);
            });

            return(resJson);
        }
コード例 #2
0
        public async Task CreateMenu_Test()
        {
            // Act
            var menu = new MenuDto {
                Title = "Home page", Url = "www.microsoft.com"
            };

            await _menuAppService.CreateAsync(menu);

            // Assert
            var menus = await _menuAppService
                        .GetAllAsync(new Abp.Application.Services.Dto.PagedAndSortedResultRequestDto {
                MaxResultCount = 10
            });

            menus.TotalCount.ShouldBeGreaterThan(0);
        }
コード例 #3
0
        public async Task Get_Page_By_URL_Test()
        {
            // Act
            var page = new PageDto
            {
                Title        = "About us",
                CreationTime = Clock.Now,
                PageType     = PageType.Page
            };

            page = await CreatePage(page);

            var widget = new WidgetDto
            {
                Content    = "Welcome!",
                PageId     = page.Id,
                Order      = 0,
                Position   = Domain.Enum.Position.Left,
                SizeType   = Domain.Enum.SizeType._100,
                WidgetType = Domain.Enum.WidgetType.Paragraph
            };

            await _widgetAppService.Save(widget);

            var menu = new MenuDto
            {
                PageId     = page.Id,
                Title      = "About us",
                IsExternal = false,
                Url        = "about-us"
            };

            await _menuAppService.CreateAsync(menu);

            var result = await _sitePageAppService.GetPageByUrl("about-us");

            // Assert
            result.Title.ShouldBe("About us");
            result.Widgets.ShouldNotBeNull();
            result.Widgets.First().Content.ShouldBe("Welcome!");
        }
コード例 #4
0
 public virtual async Task CreateAsync(MenuCreateInputDto input)
 {
     await menuAppService.CreateAsync(input, true);
 }
コード例 #5
0
 public async Task <ActionResult <long> > CreateAsync([FromBody] MenuCreationDto menuDto)
 {
     return(CreatedResult(await _menuService.CreateAsync(menuDto)));
 }
コード例 #6
0
ファイル: MenuController.cs プロジェクト: zhouhongjie/abp-vue
 public virtual Task <MenuDto> CreateAsync(CreateOrUpdateMenuDto input)
 {
     return(_menuAppService.CreateAsync(input));
 }
コード例 #7
0
        public virtual async Task SeedAsync(Guid roleid)
        {
            var entitys = await menuAppService.GetEntitysAsync(new MenuRetrieveInputDto()
            {
                MaxResultCount = LimitedResultRequestDto.MaxMaxResultCount
            });

            if (!entitys.Items.Any())
            {
                await menuAppService.CreateAsync(new MenuCreateInputDto()
                {
                    Code    = "A01",
                    Name    = "云数据中心",
                    Icon    = "fa fa-bars",
                    Sort    = 1,
                    RoleIds = new Guid[] { roleid }
                });

                await menuAppService.CreateAsync(new MenuCreateInputDto()
                {
                    Code       = "A0101",
                    Name       = "你的菜单",
                    Icon       = "fa fa-bars",
                    Sort       = 1,
                    ParentCode = "A01",
                    Url        = "/main/view/equipmentgroup/index.html",
                    RoleIds    = new Guid[] { roleid }
                });

                await menuAppService.CreateAsync(new MenuCreateInputDto()
                {
                    Code    = "A02",
                    Name    = "系统设置",
                    Icon    = "fa fa-bars",
                    Sort    = 2,
                    RoleIds = new Guid[] { roleid }
                });

                await menuAppService.CreateAsync(new MenuCreateInputDto()
                {
                    Code       = "A0201",
                    Name       = "菜单管理",
                    Icon       = "fa fa-bars",
                    Sort       = 1,
                    ParentCode = "A02",
                    Url        = "/main/view/menu/index.html",
                    RoleIds    = new Guid[] { roleid }
                });

                await menuAppService.CreateAsync(new MenuCreateInputDto()
                {
                    Code       = "A0202",
                    Name       = "角色权限管理",
                    Icon       = "fa fa-bars",
                    Sort       = 2,
                    ParentCode = "A02",
                    Url        = "/main/view/rolemenuand/index.html",
                    RoleIds    = new Guid[] { roleid }
                });

                await menuAppService.CreateAsync(new MenuCreateInputDto()
                {
                    Code       = "A0203",
                    Name       = "用户管理",
                    Icon       = "fa fa-bars",
                    Sort       = 3,
                    ParentCode = "A02",
                    Url        = "/main/view/user/index.html",
                    RoleIds    = new Guid[] { roleid }
                });

                await menuAppService.CreateAsync(new MenuCreateInputDto()
                {
                    Code       = "A0204",
                    Name       = "系统审计日志",
                    Icon       = "fa fa-bars",
                    Sort       = 4,
                    ParentCode = "A02",
                    Url        = "/main/view/auditLogging/index.html",
                    RoleIds    = new Guid[] { roleid }
                });
            }
        }