Beispiel #1
0
        public async Task <IActionResult> EditArticle(KnowledgebaseArticleModel model, bool continueEditing)
        {
            var knowledgebaseArticle = await _knowledgebaseService.GetKnowledgebaseArticle(model.Id);

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

            if (ModelState.IsValid)
            {
                knowledgebaseArticle = await _knowledgebaseViewModelService.UpdateKnowledgebaseArticleModel(knowledgebaseArticle, model);

                SuccessNotification(_localizationService.GetResource("Admin.ContentManagement.Knowledgebase.KnowledgebaseArticle.Updated"));
                return(continueEditing ? RedirectToAction("EditArticle", new { knowledgebaseArticle.Id }) : RedirectToAction("EditCategory", new { id = model.ParentCategoryId }));
            }

            //If we got this far, something failed, redisplay form
            await _knowledgebaseViewModelService.PrepareCategory(model);

            //Store
            await model.PrepareStoresMappingModel(knowledgebaseArticle, _storeService, true);

            //ACL
            await model.PrepareACLModel(knowledgebaseArticle, true, _customerService);

            return(View(model));
        }
Beispiel #2
0
        public async Task <IActionResult> EditArticle(KnowledgebaseArticleModel model, bool continueEditing)
        {
            var knowledgebaseArticle = await _knowledgebaseService.GetKnowledgebaseArticle(model.Id);

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

            if (ModelState.IsValid)
            {
                knowledgebaseArticle = await _knowledgebaseViewModelService.UpdateKnowledgebaseArticleModel(knowledgebaseArticle, model);

                Success(_translationService.GetResource("Admin.Content.Knowledgebase.KnowledgebaseArticle.Updated"));
                return(continueEditing ? RedirectToAction("EditArticle", new { knowledgebaseArticle.Id }) : RedirectToAction("EditCategory", new { id = model.ParentCategoryId }));
            }

            //If we got this far, something failed, redisplay form
            await _knowledgebaseViewModelService.PrepareCategory(model);

            return(View(model));
        }