public async Task <ActionResult> Post([FromBody] ForgotPasswordViewModel model) { if ( string.IsNullOrWhiteSpace(model.Username) || string.IsNullOrWhiteSpace(model.Email) || string.IsNullOrWhiteSpace(model.FirstName) || string.IsNullOrWhiteSpace(model.LastName)) { return(new UnauthorizedResult()); } else { MemberModel UnameMember = await _userManager.FindByNameAsync(model.Username); MemberModel EmailMember = await _userManager.FindByEmailAsync(model.Email); if ( UnameMember != null && UnameMember == EmailMember && UnameMember.FirstName == model.FirstName && EmailMember.LastName == model.LastName) { var token = await _userManager.GeneratePasswordResetTokenAsync(UnameMember); var resetLink = Url.Action("ResetPassword", "Home", new { UserId = EmailMember.Id, Token = token }, Request.Scheme); _memberServices.SendResetLink(UnameMember, resetLink); return(new OkResult()); } return(new UnauthorizedResult()); } }