예제 #1
0
        public ActionResult UpdateCategory(int id)
        {
            ManiCategoriesViewModel model = new ManiCategoriesViewModel()
            {
                Category   = _categoryManager.GetCategory(id),
                ButtonName = "Update Category",
            };

            return(View(model));
        }
예제 #2
0
        public ActionResult AddNewCategory()
        {
            ManiCategoriesViewModel model = new ManiCategoriesViewModel()
            {
                Category   = new Category(),
                ButtonName = "Add Category"
            };

            return(View(model));
        }
예제 #3
0
 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"));
 }
예제 #4
0
 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"));
 }