public ActionResult AddCategory(CategoryViewModel categoryViewModel)
 {
     CategoryModel cateModel = new CategoryModel();
     if (cateModel.AddCategory(categoryViewModel.CategoryName, categoryViewModel.Status) == true)
     {
         return RedirectToAction("Index");
     }
     else
     {
         return RedirectToAction("Error");
     }
 }
 //
 // GET: /Category/
 public ActionResult Index()
 {
     var catModel = new CategoryModel();
     var listCategoryViewModel = new List<CategoryViewModel>();
     foreach (var cte in catModel.ListCategory())
     {
         var categoryViewModel = new CategoryViewModel();
         categoryViewModel.CategoryName = cte.CategoryName;
         categoryViewModel.Status = cte.Status;
         categoryViewModel.Id = cte.Id;
         listCategoryViewModel.Add(categoryViewModel);
     }
     return View(listCategoryViewModel);
 }
        //
        //Get: /Category/CategoryEdit
        public ActionResult UpdateCategory(int id)
        {
            var _catModel = new CategoryModel();
            CategoryViewModel categoryViewModel = new CategoryViewModel();
            foreach (var cate in _catModel.FindCategory(id))
            {
                categoryViewModel.CategoryName = cate.CategoryName;
                categoryViewModel.Status = cate.Status;
            }

            List<SelectListItem> listStatus = new List<SelectListItem>();
            listStatus.Add(new SelectListItem() { Text = "Đang Hoạt Động", Value = "Available", Selected = true });
            listStatus.Add(new SelectListItem() { Text = "Ngưng Hoạt Động", Value = "Not Available", Selected = false });
            ViewBag.Status = listStatus;

            return View(categoryViewModel);
        }
 public ActionResult UpdateCategory(CategoryViewModel categoryViewModel)
 {
     var _catModel = new CategoryModel();
     if (_catModel.Update(categoryViewModel.Id, categoryViewModel.CategoryName, categoryViewModel.Status) == true)
     {
         return RedirectToAction("Index");
     }
     else
     {
         return RedirectToAction("UpdateCategory/" + categoryViewModel.Id);
     }
 }