public ActionResult UpdatePassword(string oldpassword, string newpassword) { UserViewModel model = new UserViewModel { UserEntity = UserInfo }; string message = null; try { if (string.Equals(oldpassword.ToMD5(), model.UserEntity.EncryptedPassword, StringComparison.InvariantCultureIgnoreCase)) { UserService service = new UserService(); model.UserEntity.EncryptedPassword = newpassword.ToMD5(); service.ResetUserPassword(model.UserEntity); } else { message = "原密码输入错误!"; } } catch (Exception e) { LogService.Log("UpdatePassword 出错了!", e.ToString()); message = "密码更新失败!"; } model.ErrorMsg = message; return View(model); }