public int InsertCategory(tblCat model)
 {
     SqlParameter[] param = new SqlParameter[] {
         new SqlParameter("@CatName", model.CatName),
         new SqlParameter("@CatDescription", model.CatDescription)
     };
     return(context.Database.ExecuteSqlCommand("PSP_tblCat_ThemCategory @CatName,@CatDescription", param));
 }
Example #2
0
        public ActionResult Create(tblCat model)
        {
            var result = new CategoryDao().InsertCategory(model);

            if (result > 0 && ModelState.IsValid)
            {
                SetAlert("Them thanh coong", "success");
            }
            else
            {
                //SetAlert("Them khong thanh coong", "error");
                ModelState.AddModelError("", "Them khong thanh cong");
            }
            return(View(model));
        }