public async Task <ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { var user = new UserInformation { UserName = model.Email, Email = model.Email, Password = model.Password }; var result = await UserSignInManager.CreateAsync(user); if (result.Succeeded) { await UserSignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); return(RedirectToAction("Index", "Home")); } AddErrors(result); } // If we got this far, something failed, redisplay form return(View(model)); }
public async Task <IActionResult> Register(RegisterViewModel model, string returnUrl = null) { ViewData["ReturnUrl"] = returnUrl; if (ModelState.IsValid) { var user = new UserInformation { UserName = model.Email, Email = model.Email }; var result = await _userAuthBusiness.CreateAsync(user, model.Password); if (result.Succeeded) { _logger.LogInformation(3, "User created a new User with password."); return(RedirectToLocal(returnUrl)); } AddErrors(result); } // If we got this far, something failed, redisplay form return(View(model)); }