public async Task <IActionResult> ConfirmEmail(string userId, string code) { if (userId == null || code == null) { return(RedirectToAction(nameof(HomeController.Index), "Home")); } var user = await _userManager.FindByIdAsync(userId); if (user == null) { throw new ApplicationException($"Unable to load user with ID '{userId}'."); } var result = await _userManager.ConfirmEmailAsync(user, code); return(View(result.Succeeded ? "ConfirmEmail" : "Error")); }