Beispiel #1
0
 public ActionResult AddNewBrand(CatalogBrand entity)
 {
     if (ModelState.IsValid)
     {
         var catalogDao = new CatalogDao();
         try
         {
             int check = catalogDao.AddNewBrand(entity);
             if (check == 1)
             {
                 TempData["Message"] = "Thêm thương hiệu thành công";
                 return(RedirectToAction("index"));
             }
             ModelState.AddModelError("", "Đã tồn tại tên thương hiệu");
             return(View("AddNewBrand"));
         }
         catch (Exception)
         {
             ModelState.AddModelError("", "Lỗi!");
             return(View("AddNewBrand"));
         }
     }
     return(View("AddNewBrand"));
 }