Exemplo n.º 1
0
        public async Task <PagedModel <V1ContractsPublicItem> > PublicItemsAsync(int contractId, int page)
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.ContractsV1PublicItems(contractId, page), _testing);

            EsiModel esiRaw = await PollyPolicies.WebExceptionRetryWithFallbackAsync.ExecuteAsync(async() => await _webClient.GetAsync(StaticMethods.CreateHeaders(), url, 3600));

            IList <EsiV1ContractsPublicItem> esiModel = JsonConvert.DeserializeObject <IList <EsiV1ContractsPublicItem> >(esiRaw.Model);

            IList <V1ContractsPublicItem> mapped = _mapper.Map <IList <EsiV1ContractsPublicItem>, IList <V1ContractsPublicItem> >(esiModel);

            return(new PagedModel <V1ContractsPublicItem> {
                Model = mapped, MaxPages = esiRaw.MaxPages, CurrentPage = page
            });
        }