So, I'm just catching up on the old MVC 5 stuff now that I'm out of university.
I just looked at this implementation, its point 3. about registering a user, i noticed it used async:
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Register(RegisterViewModel model)
{
if (ModelState.IsValid)
{
var user = new ApplicationUser() { UserName = model.UserName };
var result = await UserManager.CreateAsync(user, model.Password);
if (result.Succeeded)
{
await SignInAsync(user, isPersistent: false);
return RedirectToAction("Index", "Home");
}
else
{
AddErrors(result);
}
}
// If we got this far, something failed, redisplay form
return View(model);
}
I just want a bit of clarity, I am familiar with the async keyword and its association with Task and await, do you have to use this with Ajax operations?
Can it be used with Ajax operations?
If so, I guess Ajax would be the best way to achieve it.