Back to list
Views:   4.4K
Replies:  1

Using Task and Async in Controllers

Has anyone tried using Task and Async with Spark? See example below
 public async Task<ActionResult> AddPhoneNumber(AddPhoneNumberViewModel model)        {            if (!ModelState.IsValid)            {                return View(model);            }            // 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 });        }

Theophilus Medeiros, Oct 14, 2015
Reply 1
Just a heads up. The next release of SPARK fully supports Async method calls.

Hope this helps.
Jack Poorte, Nov 04, 2015
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.