Example #1
0
        public ActionResult Edit(About collection)
        {
            AboutDao bdDao = new AboutDao();

            try
            {
                UserLogin us = (UserLogin)Session[SystemConsts.USER_SESSION];

                collection.ModifiedBy   = us.UserName;
                collection.ModifiedDate = Hepper.GetDateServer();


                if (bdDao.Update(collection))
                {
                    SetAlert(@Resources.ResourceAdmin.AdminEditRecordSucess, "success");
                    return(RedirectToAction("Index"));
                }
                else
                {
                    SetAlert(@Resources.ResourceAdmin.AdminEditRecordFailed, "danger");
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                SetAlert(@Resources.ResourceAdmin.AdminEditRecordFailed, "danger");
                return(View());
            }
        }
Example #2
0
        public ActionResult Index(About entity)
        {
            var dao = new AboutDao();

            entity.CreateBy   = ((UserLoginSession)Session[ConstantSession.USER_SESSION]).UserName;
            entity.ModifiedBy = ((UserLoginSession)Session[ConstantSession.USER_SESSION]).UserName;

            dao.Update(entity);
            return(View(entity));
        }
 public ActionResult Edit(About about)
 {
     if (ModelState.IsValid)
     {
         var dao    = new AboutDao();
         var result = dao.Update(about);
         if (result)
         {
             return(RedirectToAction("Index", "About"));
         }
         else
         {
             ModelState.AddModelError("", "Không thêm được");
         }
     }
     return(View("Index"));
 }
        public ActionResult Edit(About about)
        {
            var dao    = new AboutDao();
            var result = dao.Update(about);

            if (result)
            {
                SetAlert("Add user successfully", "success");
                return(RedirectToAction("Index", "About"));
            }
            else
            {
                SetAlert("Update user failure", "danger");
                ModelState.AddModelError("", "Update user failure");
            }
            return(View("Index"));
        }
Example #5
0
 public ActionResult Edit(About model)
 {
     if (ModelState.IsValid)
     {
         var session = (UserLogin)Session[CommonConstants.USER_SESSION];
         model.ModifiedBy = session.UserName;
         var dao    = new AboutDao();
         var result = dao.Update(model);
         if (result)
         {
             SetAlert("Update content thành công", "success");
             return(RedirectToAction("Index", "About"));
         }
         else
         {
             ModelState.AddModelError("", "Cập nhật content không thành công");
         }
     }
     return(View());
 }
Example #6
0
        public ActionResult Edit(About model)
        {
            if (ModelState.IsValid)
            {
                var dao = new AboutDao();

                if (!string.IsNullOrEmpty(model.Name))
                {
                    var result = dao.Update(model);
                    if (result)
                    {
                        return(RedirectToAction("Index", "About"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "Cap nhap thanh cong");
                    }
                }
            }
            return(View());
        }