public async Task<ActionResult> ResetPassword(ResetPasswordViewModel model)
 {
     if (!ModelState.IsValid)
     {
         return View(model);
     }
     var user = await UserManager.FindByNameAsync(model.Email);
     if (user == null)
     {
         // Don't reveal that the user does not exist
         return RedirectToAction("ResetPasswordConfirmation", "Account");
     }
     var result = await UserManager.ResetPasswordAsync(user.Id, model.Code, model.Password);
     if (result.Succeeded)
     {
         return RedirectToAction("ResetPasswordConfirmation", "Account");
     }
     AddErrors(result);
     return View();
 }
        public async Task<ActionResult> ResetPassword(ResetPasswordViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = await UserManager.FindByNameAsync(model.Email);
                if (user == null)
                {
                    ModelState.AddModelError("", "No user found.");
                    return View();
                }
                IdentityResult result = await UserManager.ResetPasswordAsync(user.Id, model.Code, model.Password);
                if (result.Succeeded)
                {
                    return RedirectToAction("ResetPasswordConfirmation", "Account");
                }
                else
                {
                    AddErrors(result);
                    return View();
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }