//public JsonResult ExisteRUC(string ruc) //{ // var empresa = proxy.ListarEmpresas().Where(c => c.NumeroRuc.Equals(ruc)).FirstOrDefault(); // if (empresa != null) // return new JsonResult { Data = false }; // return new JsonResult { Data = true }; // // return Json(true, JsonRequestBehavior.AllowGet); // //return Json("Email address in use", JsonRequestBehavior.AllowGet); //} //public JsonResult ExisteEmail(string email) //{ // var empresa = proxy.ListarEmpresas().Where(c => c.EmailContacto.Equals(email)).FirstOrDefault(); // if (empresa != null) // return new JsonResult { Data = false }; // return new JsonResult { Data = true }; //} public ActionResult Registrar() { //var listaRubros = proxy.ListarRubros(); var webClient = new WebClient(); var json = webClient.DownloadString(BASE_URL + "/Rubros"); var js = new JavaScriptSerializer(); //var listaRubros = js.Deserialize<List<Rubro>>(json); var listaRubros = new SelectList(js.Deserialize<List<Rubro>>(json), "Id", "Descripcion"); RegisterViewModel viewModel = new RegisterViewModel(); ViewBag.ListaRubros = listaRubros; return View(); }
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) { await SignInManager.SignInAsync(user, isPersistent:false, rememberBrowser:false); // Para obtener más información sobre cómo habilitar la confirmación de cuenta y el restablecimiento de contraseña, visite http://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); }