// GET: Admin/Category
        public ActionResult Index()
        {
            var dao   = new CategoryDetailDao();
            var model = dao.ListAllPaging();

            return(View(model));
        }
        public ActionResult Create(CategoryDetail model)
        {
            if (ModelState.IsValid)
            {
                var dao = new CategoryDetailDao();

                long id = dao.Insert(model);
                if (id > 0)
                {
                    return(RedirectToAction("Index", "CategoryDetail"));
                }
                else
                {
                    ModelState.AddModelError("", "Them thanh cong");
                }
            }
            return(View("Index"));
        }
        public ActionResult Edit(CategoryDetail model)
        {
            if (ModelState.IsValid)
            {
                var dao = new CategoryDetailDao();

                if (!string.IsNullOrEmpty(model.Name))
                {
                    var result = dao.Update(model);
                    if (result)
                    {
                        return(RedirectToAction("Index", "CategoryDetail"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "Cap nhap thanh cong");
                    }
                }
            }
            return(View());
        }
        public ActionResult Edit(int id)
        {
            var user = new CategoryDetailDao().ViewDetail(id);

            return(View(user));
        }