public async Task <IActionResult> SendChangeEmail([FromBody] SendChangeEmailRequest request) { if (!ModelState.IsValid) { return(BadRequest()); } var user = await _userManager.FindByNameAsync(User.Identity.Name); if (user == null) { return(BadRequest()); } var code = await _userManager.GenerateChangeEmailTokenAsync(user, request.NewEmailAddress); string baseURL = $"{Request.Scheme}://{Request.Host.Value}"; await _emailSender.SendChangeEmail(user, request.NewEmailAddress, code, baseURL); return(Ok()); }