public async Task <ActionResult> AddPhoneNumber(AddPhoneNumberViewModel model) { DatabaseControler dc = new DatabaseControler(); if (!ModelState.IsValid) { var list = dc.GetDirectPhoneNumbers(); SelectList slist = new SelectList(list, "Id", "Name", "Polska"); model.Countries = slist; return(View(model)); } // Generate the token and send it var number = dc.GetDirectPhoneNumber(int.Parse(model.Country)) + model.Number.Replace(" ", ""); var code = await UserManager.GenerateChangePhoneNumberTokenAsync(User.Identity.GetUserId(), number); if (UserManager.SmsService != null) { var message = new IdentityMessage { Destination = number, Body = "Twoj kod weryfikacyjny: " + code }; await UserManager.SmsService.SendAsync(message); } return(RedirectToAction("VerifyPhoneNumber", new { PhoneNumber = number })); }
// // GET: /Manage/AddPhoneNumber public ActionResult AddPhoneNumber() { DatabaseControler dc = new DatabaseControler(); var list = dc.GetDirectPhoneNumbers(); var model = new AddPhoneNumberViewModel(); SelectList slist = new SelectList(list, "Id", "Name", "Polska"); model.Countries = slist; return(View(model)); }