public ActionResult UpdateDo(AdminUser User) { AdminUserBLL bll = new AdminUserBLL(); if (User.Password == null) { User.Password = bll.Get(User.ID).Password; } else { User.Password = Des.GetMD5String(User.Password); } bll.Update(User); return RedirectToAction("UserList", "AdminUser"); }
public ActionResult SaveUser(int UserID, string Mobile, string BankName, string BankAccount) { AdminUserBLL bll = new AdminUserBLL(); AdminUser user = bll.Get(UserID); user.Mobile = Mobile; user.BankName = BankName; user.BankAccount = BankAccount; bll.Update(user); return RedirectToAction("UserInfo", "AdminUser"); }
public ActionResult ResetPassword(string OldPassword = "", string NewPassword = "", string CheckPassword = "") { if (Request["Message"] == null) { return View(); } AdminUser user = CheckLogin.Instance.GetUser(); if (user == null) { return RedirectToAction("Login", "Home"); } if (user.Password != Des.GetMD5String(OldPassword)) { ViewBag.Message = "旧密码不正确!"; return View(); } Regex reg = new Regex(RegexPatton.PasswordPatton); if (!reg.Match(NewPassword).Success) { ViewBag.Message = "新密码格式不正确!"; return View(); } if (NewPassword == "" || NewPassword != CheckPassword) { ViewBag.Message = "两次新密码输入不正确!"; return View(); } user.Password = Des.GetMD5String(NewPassword); AdminUserBLL bll = new AdminUserBLL(); if (bll.Update(user)) return RedirectToAction("LogOut", "Home"); else { ViewBag.Message = "修改密码失败!"; return View(); } }