public ActionResult CreateCategory(CategoryViewModel model) { if (IsModelValidAndPersistErrors()) { _categoryServices.CreateCategory(model.Name, model.Description); SetSuccess("Category created"); return RedirectToAction("Forums"); } return RedirectToSelf(); }
public ActionResult EditCategory(CategoryViewModel model) { if (IsModelValidAndPersistErrors()) { Category category = _categoryRepository.Get(model.CategoryID); category.Name = model.Name; category.Description = model.Description; _categoryRepository.Update(category); SetSuccess("Category Updated"); return RedirectToAction("Forums"); } return RedirectToSelf(); }
public ActionResult CreateCategory() { CategoryViewModel model = new CategoryViewModel(); return View(model); }
public ActionResult EditCategory(int categoryID) { Category category = _categoryRepository.Get(categoryID); CategoryViewModel model = new CategoryViewModel() { CategoryID = category.CategoryID, Description = category.Description, Name = category.Name }; return View(model); }