Controllers/AccountController.cs
/// <summary>
/// The Action associated with submitting the registration form
/// </summary>
/// <param name="model">
/// The view model containing the user's account information
/// </param>
/// <returns>The Http response to the POST request</returns>
The Action associated with submitting the registration form
The Action associated with submitting the registration form
[HttpPost]
        [AllowAnonymous]
        public async Task<IActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var result = await CreateUser(model);
                if (result.Succeeded) {
                    return RedirectToAction("Login", "Account");
                } else {
                    foreach (var e in result.Errors) {
                        ModelState.AddModelError(e.Code, e.Description);
                    }
                    return View(model);
                }
            }
            return View(model);
        }
[ HttpPost ] [ AllowAnonymous ] public async Task < IActionResult > Register ( RegisterViewModel model ) { if ( ModelState . IsValid ) { var result = await CreateUser ( model ) ; if ( result . Succeeded ) { return RedirectToAction ( " " , " " ) ; } else { foreach ( var e in result . Errors ) { ModelState . AddModelError ( e . Code , e . Description ) ; } return View ( model ) ; } } return View ( model ) ; }
The Action associated with submitting the registration form
The Action associated with submitting the registration form
The Http response to the POST request
The Http response to the POST request
model
RegisterViewModel
The view model containing the user's account information
The view model containing the user ' s account information