public async Task <IActionResult> EditCategory(KnowledgebaseCategoryModel model, bool continueEditing) { var knowledgebaseCategory = await _knowledgebaseService.GetKnowledgebaseCategory(model.Id); if (knowledgebaseCategory == null) { return(RedirectToAction("List")); } if (ModelState.IsValid) { knowledgebaseCategory = await _knowledgebaseViewModelService.UpdateKnowledgebaseCategoryModel(knowledgebaseCategory, model); SuccessNotification(_localizationService.GetResource("Admin.ContentManagement.Knowledgebase.KnowledgebaseCategory.Updated")); return(continueEditing ? RedirectToAction("EditCategory", new { id = knowledgebaseCategory.Id }) : RedirectToAction("List")); } //If we got this far, something failed, redisplay form await _knowledgebaseViewModelService.PrepareCategory(model); //Stores await model.PrepareStoresMappingModel(knowledgebaseCategory, _storeService, true); //ACL await model.PrepareACLModel(knowledgebaseCategory, true, _customerService); return(View(model)); }
public IActionResult CreateCategory(KnowledgebaseCategoryModel model, bool continueEditing) { if (ModelState.IsValid) { var knowledgebaseCategory = _knowledgebaseViewModelService.InsertKnowledgebaseCategoryModel(model); SuccessNotification(_localizationService.GetResource("Admin.ContentManagement.Knowledgebase.KnowledgebaseCategory.Added")); return(continueEditing ? RedirectToAction("EditCategory", new { knowledgebaseCategory.Id }) : RedirectToAction("List")); } //If we got this far, something failed, redisplay form //Stores model.PrepareStoresMappingModel(null, true, _storeService); //ACL model.PrepareACLModel(null, true, _customerService); return(View(model)); }