public async Task <ActionResult> Register(RegisterViewModel model) { var _context = new EgresadosU.Models.InstitucionalEntities(); ViewBag.ListDocumentTypes = _context.TiposDocumentos.ToList(); ViewBag.ListStates = _context.Estados.ToList(); if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.Email, Email = model.Email }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); // Para obtener más información sobre cómo habilitar la confirmación de cuentas y el restablecimiento de contraseña, visite https://go.microsoft.com/fwlink/?LinkID=320771 // Enviar correo electrónico con este vínculo // string 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, "Confirmar cuenta", "Para confirmar la cuenta, haga clic <a href=\"" + callbackUrl + "\">aquí</a>"); return(RedirectToAction("Index", "Home")); } AddErrors(result); } // Si llegamos a este punto, es que se ha producido un error y volvemos a mostrar el formulario return(View(model)); }
public ActionResult Register() { var _context = new EgresadosU.Models.InstitucionalEntities(); ViewBag.ListDocumentTypes = _context.TiposDocumentos.ToList(); ViewBag.ListStates = _context.Estados.ToList(); return(View()); }