public async Task<ActionResult> SetPassword(ResetUserPasswordViewModel model)
 {
     var user = await UserManager.FindByNameAsync(model.UserName);
     if (user == null)
     {
         ModelState.AddModelError("", "用户不存在。");
         model.NewPassword = model.ConfirmPassword = "";
         return View(model);
     }
     string code = await UserManager.GeneratePasswordResetTokenAsync(user.Id);
     var result = await UserManager.ResetPasswordAsync(user.Id, code, model.NewPassword);
     return RedirectToAction("Index", new { id = user.Id, message = UsersAdministrationMessageId.ResetPasswordSuccess });
 }
 public ActionResult SetPassword(string id)
 {
     ResetUserPasswordViewModel model = new ResetUserPasswordViewModel()
     {
         UserName = GetApplicationUserById(id).UserName
     };
     return View(model);
 }