public async Task <IActionResult> Delete(string sitemapId) { if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageSitemaps)) { return(Forbid()); } var sitemap = await _sitemapManager.LoadSitemapAsync(sitemapId); if (sitemap == null) { return(NotFound()); } await _sitemapManager.DeleteSitemapAsync(sitemapId); await _notifier.SuccessAsync(H["Sitemap deleted successfully."]); return(RedirectToAction(nameof(List))); }
public async Task <IActionResult> Delete(string sitemapId) { if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageSitemaps)) { return(Forbid()); } var sitemap = await _sitemapManager.LoadSitemapAsync(sitemapId); if (sitemap == null) { return(NotFound()); } // Clear sitemap cache when deleted. await _sitemapCacheProvider.ClearSitemapCacheAsync(sitemap.Path); await _sitemapManager.DeleteSitemapAsync(sitemapId); _notifier.Success(H["Sitemap index deleted successfully"]); return(RedirectToAction(nameof(Edit))); }