public async Task <ActionResult> ValidateEmail(string userId, string validationCode) { if (userId == null || validationCode == null) { return(RedirectToAction(nameof(HomeController.Index), "Home")); } try { User user = await _userManager.GetUserByIdAsync(userId); if (user == null || validationCode != user.ValidationCode) { return(RedirectToAction(nameof(HomeController.Index), "Home")); } user = UpdateUserEmailConfirmation(user); _ctx.Update(user); await _ctx.SaveChangesAsync(); } catch (Exception ex) { await _logger.LogCustomExceptionAsync(ex, null); return(RedirectToAction("Error", "Home")); } return(View("ConfirmEmail")); }