Ejemplo n.º 1
0
        public ActionResult CreateCategory()
        {
            var name   = Request.Form["Name"];
            var status = Request.Form["Status"];

            Models.IRepository <Models.ModelView.CategoryView> Category = Models.Dao.CategoryDao.Instance;
            Models.ModelView.CategoryView cate = new Models.ModelView.CategoryView();
            cate.name_category = name;
            cate.status        = bool.Parse(status);
            Category.Create(cate);
            return(RedirectToAction("Category"));
        }
Ejemplo n.º 2
0
        public ActionResult UpdateCategory()
        {
            var id         = int.Parse(Request.Form["id"]);
            var name       = Request.Form["name"];
            var status     = bool.Parse(Request.Form["status"]);
            var nameBefore = Request.Form["nameBefore"];

            Models.ModelView.CategoryView cateV = new Models.ModelView.CategoryView();
            cateV.id            = id;
            cateV.name_category = name;
            cateV.status        = status;
            Models.IRepository <Models.ModelView.CategoryView> cate = Models.Dao.CategoryDao.Instance;
            var result = cate.Update(cateV);

            if (result == 0)
            {
                return(Json("Category exits!!"));
            }
            return(Json("success"));
        }