コード例 #1
0
        public IActionResult EditCategory()
        {
            var model = new EditCategoryBaseModel
            {
                EditCategoryInputModel = new EditCategoryInputModel(),
                EditCategoryViewModels = this.addonsService.GetAllCategories(),
            };

            return(this.View(model));
        }
コード例 #2
0
        public async Task <IActionResult> EditExistingCategory(EditCategoryBaseModel model)
        {
            if (this.ModelState.IsValid)
            {
                await this.addonsService.EditExistingCategory(model.EditCategoryInputModel);

                this.TempData["Success"] = string.Format(
                    SuccessMessages.SuccessfullyEditCategory,
                    model.EditCategoryInputModel.Name.ToUpper());
                return(this.RedirectToAction("EditCategory", "BlogAddons"));
            }
            else
            {
                this.TempData["Error"] = ErrorMessages.InvalidInputModel;
                return(this.RedirectToAction("EditCategory", "BlogAddons", model));
            }
        }