public ActionResult UpdateCategory(int id) { ManiCategoriesViewModel model = new ManiCategoriesViewModel() { Category = _categoryManager.GetCategory(id), ButtonName = "Update Category", }; return(View(model)); }
public ActionResult AddNewCategory() { ManiCategoriesViewModel model = new ManiCategoriesViewModel() { Category = new Category(), ButtonName = "Add Category" }; return(View(model)); }
public ActionResult UpdateCategory(Category category) { if (!ModelState.IsValid) { ManiCategoriesViewModel model = new ManiCategoriesViewModel() { Category = _categoryManager.GetCategory(category.CategoryID), ButtonName = "Update Category", }; return(View(model)); } _categoryManager.UpdateCategory(category); TempData["message"] = "Kategori Güncellendi"; return(RedirectToAction("CategoryManiPage")); }
public ActionResult AddNewCategory(Category category) { if (!ModelState.IsValid) { ManiCategoriesViewModel model = new ManiCategoriesViewModel { Category = new Category(), ButtonName = "Add Category" }; return(View(model)); } _categoryManager.AddCategory(category); TempData["message"] = "Yeni kategori eklendi"; return(RedirectToAction("CategoryManiPage")); }