//[HasCredential(RoleID = "EDIT_USER")]
        public ActionResult Edit(User user)
        {
            if (ModelState.IsValid)
            {
                var dao = new FeedBackDao();
                if (!string.IsNullOrEmpty(user.Password))
                {
                    var encryptedMd5Pas = Encryptor.MD5Hash(user.Password);
                    user.Password = encryptedMd5Pas;
                }


                var result = dao.Update(user);
                if (result)
                {
                    SetAlert("Sửa user thành công", "success");
                    return(RedirectToAction("Index", "User"));
                }
                else
                {
                    ModelState.AddModelError("", "Cập nhật user không thành công");
                }
            }
            return(View("Index"));
        }
 public ActionResult Edit(FeedBack feedback)
 {
     if (ModelState.IsValid)
     {
         var dao    = new FeedBackDao();
         var result = dao.Update(feedback);
         if (result)
         {
             return(RedirectToAction("Index", "FeedBack"));
         }
         else
         {
             ModelState.AddModelError("", "Không thêm được");
         }
     }
     return(View("Index"));
 }
Esempio n. 3
0
 public ActionResult ViewDetail(LienHe paper)
 {
     if (ModelState.IsValid)
     {
         var  dao    = new FeedBackDao();
         bool result = dao.Update(paper);
         if (result)
         {
             return(RedirectToAction("Index", "News"));
         }
         else
         {
             ModelState.AddModelError("", "Cập nhật bài báo thất bại");
         }
     }
     return(View("Index"));
 }