Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public async Task<IActionResult> Index()
- {
- Uri BaseAdress = Services.Token.BaseAdress;
- string strToken = Services.Token.strToken;
- List<FormaPagamentoFinModel> ListaAmbientes;
- using (HttpClient httpClient = new HttpClient())
- {
- httpClient.BaseAddress = BaseAdress;
- httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", strToken);
- httpClient.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("Application/Json"));
- using (HttpResponseMessage response = await httpClient.GetAsync("/api/FormaPagamentoFin/findAll"))
- {
- response.EnsureSuccessStatusCode();
- string resul = await response.Content.ReadAsStringAsync();
- ListaAmbientes = JsonConvert.DeserializeObject<List<FormaPagamentoFinModel>>(resul);
- }
- }
- return View(ListaAmbientes);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement