Exemplo n.º 1
0
 public ActionResult Edit(Category proCate)
 {
     if (ModelState.IsValid)
     {
         var DAO = new CategoryDAO();
         proCate.MetaTitle = ConvertToUnSign.convertunsign(proCate.MetaTitle);
         var result = DAO.Update(proCate);
         if (result)
         {
             SetAlert("Cập nhật thành công", "success");
             return(RedirectToAction("Index", "Category"));
         }
         else
         {
             SetAlert("Cập nhật thất bại", "error");
             ModelState.AddModelError("", "Cập nhật thất bại");
         }
     }
     return(View("Index"));
 }
Exemplo n.º 2
0
 public ActionResult Create(Category proCate)
 {
     if (ModelState.IsValid)
     {
         var DAO = new CategoryDAO();
         proCate.MetaTitle   = ConvertToUnSign.convertunsign(proCate.MetaTitle);
         proCate.CreatedDate = DateTime.Now;
         long id = DAO.Insert(proCate);
         if (id > 0)
         {
             SetAlert("Thêm thành công", "success");
             return(RedirectToAction("Index", "Category"));
         }
         else
         {
             SetAlert("Thêm thất bại", "error");
             ModelState.AddModelError("", "Thêm thất bại");
         }
     }
     return(View("Index"));
 }
Exemplo n.º 3
0
 public ActionResult Edit(Content content)
 {
     if (ModelState.IsValid)
     {
         var DAO = new ContentDAO();
         content.MetaTitle = ConvertToUnSign.convertunsign(content.MetaTitle);
         var result = DAO.Update(content);
         if (result)
         {
             SetAlert("Cập nhật thành công", "success");
             return(RedirectToAction("Index", "Content"));
         }
         else
         {
             SetAlert("Cập nhật thất bại", "error");
             ModelState.AddModelError("", "Cập nhật thất bại");
         }
     }
     SetViewBag(content.CategoryID);
     return(View("Index"));
 }
Exemplo n.º 4
0
        public ActionResult Edit(Menu menu)
        {
            if (ModelState.IsValid)
            {
                var DAO = new MenuDAO();
                menu.Link = ConvertToUnSign.convertunsign(menu.Link);
                var result = DAO.Update(menu);
                if (result)
                {
                    SetAlert("Cập nhật thành công", "success");
                    return(RedirectToAction("Index", "Menu"));
                }
                else
                {
                    SetAlert("Cập nhật thất bại", "error");
                    ModelState.AddModelError("", "Cập nhật thất bại");
                }
            }

            return(View("Index"));
        }
Exemplo n.º 5
0
        public ActionResult Create(Menu menu)
        {
            if (ModelState.IsValid)
            {
                var DAO = new MenuDAO();
                menu.Link = ConvertToUnSign.convertunsign(menu.Link);
                long id = DAO.Insert(menu);
                if (id > 0)
                {
                    SetAlert("Thêm thành công", "success");
                    return(RedirectToAction("Index", "Menu"));
                }
                else
                {
                    SetAlert("Thêm thất bại", "error");
                    ModelState.AddModelError("", "Thêm thất bại");
                }
            }

            return(View("Index"));
        }
Exemplo n.º 6
0
 public ActionResult Create(Product product)
 {
     if (ModelState.IsValid)
     {
         var DAO = new ProductDAO();
         product.MetaTitle = ConvertToUnSign.convertunsign(product.MetaTitle);
         long id = DAO.Insert(product);
         if (id > 0)
         {
             SetAlert("Thêm thành công", "success");
             return(RedirectToAction("Index", "Product"));
         }
         else
         {
             SetAlert("Thêm thất bại", "error");
             ModelState.AddModelError("", "Thêm thất bại");
         }
     }
     SetViewBag();
     return(View("Index"));
 }