public async Task <IActionResult> OnGetAsync() { var token = HttpContext.Session.GetString("token"); Owner = User.Claims.Where(x => x.Type == "Owner").Select(x => x.Value).SingleOrDefault(); if (token == null || token == "" || token == "null" || Owner == null) { return(RedirectToPage("/logout")); } Confirmant = User.Claims.Where(x => x.Type == "Confirmant").Select(x => x.Value).SingleOrDefault(); Participant = User.Claims.Where(x => x.Type == "Participant").Select(x => x.Value).SingleOrDefault(); Country = User.Claims.Where(x => x.Type == "Country").Select(x => x.Value).SingleOrDefault(); Discriminator = User.Claims.Where(x => x.Type == "Discriminator").Select(x => x.Value).SingleOrDefault(); var Auth = (await _AuthorizationService.AuthorizeAsync(User, "PolicyProfileChange")).Succeeded; var AuthRol = User.IsInRole("LEGAL"); TipoParticipante = Participant; switch (Participant) { case "CONFIRMANT": NRol = 5; break; case "DEBTOR": NRol = 1; break; case "FACTOR": NRol = 3; break; case "SUPPLIER": NRol = 2; break; case "BACKOFFICE": NRol = 6; break; } registrarClienteTF.User = new User(); registrarClienteTF.Registrarse = new PesonProfile(); registrarClienteTF.User.Participant = Participant; registrarClienteTF.User.Discriminator = Discriminator; if (HttpContext.Session.GetString("CountryPerfil") == null || HttpContext.Session.GetString("CountryPerfil") == "null" || HttpContext.Session.GetString("CountryPerfil") == "") { registrarClienteTF.DataPaises = await _globalService.ConsultasCountryTF(new ParamCountry { Id = Int32.Parse(Request.Cookies["Country"]) }); HttpContext.Session.SetString("CountryPerfil", JsonConvert.SerializeObject(registrarCliente.DataPaises)); } else { registrarClienteTF.DataPaises = JsonConvert.DeserializeObject <ListCountry>(HttpContext.Session.GetString("CountryPerfil")); } filterInvoice PeopleId = new filterInvoice(); PeopleId.Id = Owner; registrarClienteTF.Perfil = await _peopleService.RegisterById(new ParamProspecto { Participant = Participant, Filter = PeopleId, Country = int.Parse(Country) }, token); if (registrarClienteTF.Perfil.Addresses != null) { registrarClienteTF.Cities = await _globalService.ConsultaCitiesTF(new ParamCountry { Id = Int32.Parse(Request.Cookies["Country"]), Region = registrarClienteTF.Perfil.Addresses[0].Region }); } if (registrarClienteTF.Perfil != null && registrarClienteTF.Perfil.Contacts != null && registrarClienteTF.Perfil.Contacts.Count > 0) { foreach (var legal in registrarClienteTF.Perfil.Contacts) { if (legal.Label == "LEGAL") { HttpContext.Session.SetString("RepresentanteLegal", JsonConvert.SerializeObject(legal)); } } } RellenarPerfil(); registrarClienteTF.AuthRol = Auth; registrarClienteTF.ContratAuth = (await _AuthorizationService.AuthorizeAsync(User, "PolicyContracts")).Succeeded; registroJson = JsonConvert.SerializeObject(registrarClienteTF); return(Page()); }
public async Task <JsonResult> OnPostSelectCity([FromBody] GlobalRegister Region) { ListCountry country = await _globalService.ConsultaCitiesTF(new ParamCountry { Id = Int32.Parse(Request.Cookies["Country"]), Region = Region.State }); return(new JsonResult(country.Regions[0].Cities)); }