public async Task <IActionResult> ListTree(string cmsType, string?lang, string?q) { var cmsMenuItem = schemaService.GetCmsType(cmsType); if (cmsMenuItem == null || !cmsMenuItem.IsTree) { return(new NotFoundResult()); } var treeItem = await cmsTreeService.GetCmsTreeItem(cmsType, lang); if (treeItem == null) { return(new NotFoundResult()); } if (!string.IsNullOrEmpty(q)) { treeItem.Nodes = treeItem.Nodes .Where(x => x.Name?.Contains(q, StringComparison.InvariantCultureIgnoreCase) ?? false) .ToList(); } //Order treeItem.Nodes = treeItem.Nodes.OrderBy(x => x.GetSlug(treeItem.Nodes)).ToList(); var model = new ListTreeViewModel { CmsType = cmsType, MenuCmsItem = cmsMenuItem, CmsTreeItem = treeItem, }; return(View("ListTree", model)); }
public async Task ClearData() { var schemas = jsonSchemaService.GetCmsConfiguration(); foreach (var menuItem in schemas.MenuItems) { if (menuItem.Key != null) { var(allItems, _) = await dataProviderService.List(menuItem.Key, null, null); foreach (var item in allItems) { await dataProviderService.Delete(menuItem.Key, item.Id, null, null); } } } string cmsTreeType = PageTreeRoutes.PageTreeType; var tree = await cmsTreeService.GetCmsTreeItem(cmsTreeType, null); foreach (var item in tree.Nodes) { await cmsTreeService.ClearCmsTreeNode(cmsTreeType, item.NodeId, null, null); } }