public async Task <ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.Email, Email = model.Email }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { UserManager.AddToRole(user.Id, "Employee"); #region Assign UserDetails During Registration UserDetail nUser = new UserDetail(); nUser.UserID = user.Id; nUser.FirstName = model.FirstName; nUser.LastName = model.LastName; LMSProjectEntities db = new LMSProjectEntities(); db.UserDetails.Add(nUser); db.SaveChanges(); #endregion #region Removed Email Confirmed Demo //var code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); //var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); //await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking this link: <a href=\"" + callbackUrl + "\">link</a>"); //ViewBag.Link = callbackUrl; //return View("DisplayEmail"); #endregion //let user login with new account instead return(View("Login")); } AddErrors(result); } // If we got this far, something failed, redisplay form return(View(model)); }