public ActionResult Edit(Publisher publisher, FormCollection formcollection)
 {
     if (ModelState.IsValid)
     {
         string imageURL = null;
         try
         {
             imageURL = formcollection["txtImageURL"].ToString();
         }
         catch
         {
             imageURL = "/Content/images/Image.jpg";
         }
         var dao    = new PublisherDAO();
         var result = dao.Update(publisher, imageURL);
         if (result)
         {
             return(RedirectToAction("Index", "Publisher"));
         }
         else
         {
             ModelState.AddModelError("", "Publisher không cập nhật thành công");
         }
     }
     return(View("Index"));
 }
예제 #2
0
 public ActionResult Edit(Publisher publisher)
 {
     if (ModelState.IsValid)
     {
         var dao    = new PublisherDAO();
         var result = dao.Update(publisher);
         if (result)
         {
             return(RedirectToAction("Index", "Publisher"));
         }
         else
         {
             ModelState.AddModelError("", "Publisher không cập nhật thành công");
         }
     }
     return(View("Index"));
 }
        public JsonResult Update(Publisher model)
        {
            try
            {
                int status = dao.Update(model);

                return(Json(new
                {
                    status = status
                }));
            }
            catch (Exception)
            {
                return(Json(new
                {
                    status = 0
                }));
            }
        }