コード例 #1
0
        public IActionResult DeleteArticle(string id)
        {
            var knowledgebaseArticle = _knowledgebaseService.GetKnowledgebaseArticle(id);

            if (knowledgebaseArticle == null)
            {
                return(RedirectToAction("List"));
            }

            if (ModelState.IsValid)
            {
                _knowledgebaseViewModelService.DeleteKnowledgebaseArticle(knowledgebaseArticle);
                SuccessNotification(_localizationService.GetResource("Admin.ContentManagement.Knowledgebase.KnowledgebaseArticle.Deleted"));
                return(RedirectToAction("List"));
            }
            ErrorNotification(ModelState);
            return(RedirectToAction("EditArticle", new { knowledgebaseArticle.Id }));
        }
コード例 #2
0
        public async Task <IActionResult> DeleteArticle(string id)
        {
            var knowledgebaseArticle = await _knowledgebaseService.GetKnowledgebaseArticle(id);

            if (knowledgebaseArticle == null)
            {
                return(RedirectToAction("List"));
            }

            if (ModelState.IsValid)
            {
                await _knowledgebaseViewModelService.DeleteKnowledgebaseArticle(knowledgebaseArticle);

                Success(_translationService.GetResource("Admin.Content.Knowledgebase.KnowledgebaseArticle.Deleted"));
                return(RedirectToAction("List"));
            }
            Error(ModelState);
            return(RedirectToAction("EditArticle", new { knowledgebaseArticle.Id }));
        }