コード例 #1
0
 public async Task<ActionResult> AddPhoneNumber(AddPhoneNumberViewModel model)
 {
     if (!ModelState.IsValid)
     {
         return View(model);
     }
     await UserManager.SetPhoneNumberAsync(User.Identity.GetUserId(), model.Number);
     /*
     // Generate the token and send it
     var code = await UserManager.GenerateChangePhoneNumberTokenAsync(User.Identity.GetUserId(), model.Number);
     if (UserManager.SmsService != null)
     {
         var message = new IdentityMessage
         {
             Destination = model.Number,
             Body = "Your security code is: " + code
         };
         await UserManager.SmsService.SendAsync(message);
     }
     return RedirectToAction("VerifyPhoneNumber", new { PhoneNumber = model.Number });
     */
     return RedirectToAction("Index", "Manage");
 }
コード例 #2
0
 //
 // GET: /Manage/AddPhoneNumber
 public ActionResult AddPhoneNumber()
 {
     AddPhoneNumberViewModel model = new AddPhoneNumberViewModel();
     model.Number = UserManager.GetPhoneNumber(User.Identity.GetUserId());
     return View(model);
 }