public async Task <IActionResult> SendVerificationSms(IndexViewModel model) { if (!ModelState.IsValid) { return(RedirectToAction(nameof(Index))); } var user = await _userManager.GetUserAsync(User); if (user == null) { throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); } string code = await _userManager.GenerateChangePhoneNumberTokenAsync(user, model.PhoneNumber); await _smsSender.SendVerificationCode(model.PhoneNumber, code); return(RedirectToAction(nameof(VerifyNumber))); }