public ActionResult Edit(Content content)
        {
            var dao = new ContentDao();

            if (ModelState.IsValid)
            {
                var session = (UserLogin)Session[CommonConstants.USER_SESSION];
                content.ModifiedBy = session.UserName;
                var culture = Session[CommonConstants.CurrentCulture];
                content.Language = culture.ToString();
                var result = dao.Edit(content);
                if (result)
                {
                    SetAlert("Cập nhật tin tức thành công!", "success");
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Cập nhật tin tức không thành công!");
                }
                return(RedirectToAction("Index"));
            }
            SetViewBag(content.CategoryID);
            return(View());
        }
Exemple #2
0
 public ActionResult Edit(Content content)
 {
     if (ModelState.IsValid)
     {
         var dao     = new ContentDao();
         var session = (UserLogin)Session[CommonConstants.USER_SESSION];
         var result  = dao.Edit(content);
         {
             SetAlert("Cập nhật Tin tức thành công", "success");
             return(RedirectToAction("Index", "Content"));
         }
     }
     SetViewBag(content.CategoryID);
     return(View("Index"));
 }
        public ActionResult Edit(Content model)
        {
            var order = new ContentDao();
            var res   = order.Edit(model);

            if (res)
            {
                //SetAlert("Cập nhật dữ liệu thành công", "success");
                return(RedirectToAction("Index", "Product"));
            }
            else
            {
                ModelState.AddModelError("", "cập nhật không thành công");
            }
            SetViewBag(model.CategoryID);
            return(View("Edit"));
        }
 public ActionResult Edit(Content model)
 {
     if (ModelState.IsValid)
     {
         var dao     = new ContentDao();
         var content = dao.Edit(model);
         if (content)
         {
             SetAlert("Bạn đã edit thành công", "alert-success");
             return(RedirectToAction("Index", "Content"));
         }
         else
         {
             ModelState.AddModelError("", "cập nhật thất bại");
         }
     }
     SetViewBag(model.CategoryID);
     return(View("Index"));
 }
Exemple #5
0
        public ActionResult Edit(Content content)
        {
            ViewBag.Categories = categoryDao.GetAll();
            if (!ModelState.IsValid)
            {
                return(View(content));
            }
            content.ModifiedBy   = (Session[Constants.USER_SESSION] as UserLogin).UserID.ToString();
            content.ModifiedDate = DateTime.Now;
            string result = contentDao.Edit(content);

            if (result == COMMON_CONSTANTS.EDIT_SUCCESS)
            {
                return(RedirectToAction("Index", "Content"));
            }
            else
            {
                return(RedirectToAction("Index", "Error"));
            }
        }
Exemple #6
0
 public ActionResult Edit(Content model)
 {
     if (ModelState.IsValid)
     {
         var session = (UserLogin)Session[CommonConstants.USER_SESSION];
         model.ModifiedBy   = session.UserName;
         model.ModifiedDate = DateTime.Now;
         var  dao = new ContentDao();
         long id  = dao.Edit(model);
         if (id > 0)
         {
             SetAlert("Update content thành công", "success");
             return(RedirectToAction("Index", "Content"));
         }
         else
         {
             ModelState.AddModelError("", "Cập nhật content không thành công");
         }
     }
     SetViewBag(model.CategoryID);
     return(View());
 }