Exemplo n.º 1
0
        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)));
        }
Exemplo n.º 2
0
        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)));
        }