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); } }
public async Task <IActionResult> DeleteConfirm([FromRoute] string cmsType, [FromRoute] Guid id, [FromRoute] string?lang, [FromQuery] string?treeItemSchemaKey, [FromQuery] Guid?treeNodeId) { await writeCmsItemService.Delete(cmsType, id, lang, this.User.Identity?.Name).ConfigureAwait(false); if (treeNodeId.HasValue) { await cmsTreeService.ClearCmsTreeNode(cmsType, treeNodeId.Value, lang, this.User.Identity?.Name).ConfigureAwait(false); } return(RedirectToAction("List", "List", new { cmsType = cmsType })); }