Exemplo n.º 1
0
        public async Task <JsonResult> OnPostLlenarTabla([FromBody] RequestPagination pag)
        {
            var IdUser = User.Claims.Where(x => x.Type == ClaimTypes.NameIdentifier).Select(x => x.Value).SingleOrDefault();

            Owner       = User.Claims.Where(x => x.Type == "Owner").Select(x => x.Value).SingleOrDefault();
            Participant = User.Claims.Where(x => x.Type == "Participant").Select(x => x.Value).SingleOrDefault();
            Confirmant  = User.Claims.Where(x => x.Type == "Confirmant").Select(x => x.Value).SingleOrDefault();
            Country     = User.Claims.Where(x => x.Type == "Country").Select(x => x.Value).SingleOrDefault();
            var token = HttpContext.Session.GetString("token");

            prospectoSegmentar = await _peopleService.ConsultaDatosParaSegmentarAsync(Confirmant, pag.Filter, pag.Pagination, token);

            if (prospectoSegmentar.Error == null)
            {
                var id = User.Claims.Where(x => x.Type == "Id").Select(x => x.Value).SingleOrDefault();
                var l  = await _aS.RefreshToken(id, CultureInfo.CurrentCulture.Name, Participant, token, Confirmant);

                if (l.Error == null)
                {
                    HttpContext.Session.SetString("token", l.Token);
                }
            }
            if (prospectoSegmentar != null)
            {
                prospectoSegmentar.List.Sort((b, a) => a.CreatedAt.Date.CompareTo(b.CreatedAt.Date));
            }
            var Estados = await _globalService.ConsultaEstatesTF(new ParamCountry { Id = Int32.Parse(Country) });

            var ListaEjecutivos = await _authService.ConsultaListaEjectuvosAsync(Owner, Participant, token);

            return(new JsonResult(new { prospecto = prospectoSegmentar, estados = Estados, listaejecutivos = ListaEjecutivos }));
        }