Example #1
0
        public ActionResult ResetPassword(ResetPasswordViewModel model)
        {
            try
            {
                UserDto dto = new UserDto();
                Message msg = new Message();
                DataTable dt = CMSService.SelectOne("User", "CMSUser", "UserId=" + model.UserId);

                foreach (DataRow dr in dt.Rows)
                {
                    dto = UserMapping.getDTO(dr);
                    dto.UserPassword = CommonTools.ToMd5(model.UserPassword);
                }
                string JsonString = JsonHelper.JsonSerializerBySingleData(dto);
                msg = CMSService.Update("User", JsonString);
                msg.MessageStatus = "Success";
                msg.MessageInfo = "密码修改成功了";
                ViewBag.Status = msg.MessageStatus;
                // TODO: Add delete logic here

                return RedirectTo("/User/Index", msg.MessageInfo);

            }

            catch
            {
                Message msg = new Message();
                msg.MessageStatus = "Error";
                msg.MessageInfo = "操作出错了";
                ViewBag.Status = msg.MessageStatus;
                ViewBag.msg = msg.MessageInfo;
                return View();
            }
        }
Example #2
0
 // 重置密码
 public ActionResult ResetPassword(int id)
 {
     ResetPasswordViewModel model = new ResetPasswordViewModel();
     model.UserId = id;
     return View(model);
 }