Example #1
0
        public async Task <IActionResult> GetMenuSections(Guid menuId)
        {
            PaginatedEntitiesResult <SidebarMenuSectionItemViewModel> entitiesResult = await this.adminMenuService.GetAllMenuSectionsAsync <SidebarMenuSectionItemViewModel>(menuId);

            AllEntitiesViewModel model = new AllEntitiesViewModel();

            model.SingleEntityName = "Sidebar Section";
            model.Title            = "Menu Sidebar Sections";
            this.ViewData[BreadcrumbPageTitlePlaceholder] = model.Title;

            List <TableRowActionViewModel> actions = new List <TableRowActionViewModel>();

            actions.Add(TableMapper.CreateAction("Link Items", MaterialDesignIcons.ViewList, Color.DarkSlateBlue, TableRowActionMethod.Get, $"/admin/system/navigation-menus/sidebar-menu-link-items/sections/{{0}}/link-items", "[Id]"));
            actions.Add(TableMapper.DetailsAction($"/admin/system/navigation-menus/sidebar-menu-section-items/{{0}}", "[Id]"));
            actions.Add(TableMapper.EditAction($"/admin/system/navigation-menus/sidebar-menu-section-items/{{0}}/edit", "[Id]"));
            actions.Add(TableMapper.DeleteAction($"/admin/system/navigation-menus/sidebar-menu-section-items/{{0}}/delete", "[Id]"));

            model.Table = TableMapper.DtoMapper <SidebarMenuSectionItemViewModel>(entitiesResult, actions.ToArray());
            model.Table.SetPaginationRedirection("Admin", this.GetType().Name.Replace("Controller", string.Empty), nameof(this.GetAll));

            model.NavigationActions.Add(new NavigationActionViewModel
            {
                Name      = $"Create {model.SingleEntityName}",
                ActionUrl = $"/admin/system/navigation-menus/sidebar-menu-section-items/create?SchemeId={menuId}",
                Icon      = MaterialDesignIcons.Plus,
                Method    = HttpMethod.Get,
            });

            return(this.View("AbstractViews/GetAll", model));
        }
 protected virtual void TableViewActionsInit(ref List <TableRowActionViewModel> actions)
 {
     if (HasDetails)
     {
         actions.Add(TableMapper.DetailsAction($"/{this.controllerRoute}{{0}}", "[Id]"));
     }
     if (HasEdit)
     {
         actions.Add(TableMapper.EditAction($"/{this.controllerRoute}{{0}}/edit", "[Id]"));
     }
     if (HasDelete)
     {
         actions.Add(TableMapper.DeleteAction($"/{this.controllerRoute}{{0}}/delete", "[Id]"));
     }
 }