public async Task <IActionResult> SendResetPassEmail(string id) { try { if (string.IsNullOrEmpty(id)) { //error } var user = await _userHelper.GetUserByGuidIdAsync(id); if (user == null) { //error } var myToken = await _userHelper.GeneratePasswordResetTokenAsync(user); var link = Url.Action( "ResetPassword", "Account", new { validToken = myToken, userId = user.GuidId }, protocol: HttpContext.Request.Scheme); _mailHelper.SendResetEmail(user.Email, user.Name, link); var notification = await _notificationRepository.GetByGuidIdAndTypeAsync(id, NotificationType.Recover); await _notificationRepository.DeleteAsync(notification); return(RedirectToAction(nameof(UserNotifications))); } catch (Exception) { throw; } }