using PruebaAzureAD.Models; using System.Text.Json; using System; namespace PruebaAzureAD.Servicios { public class Pais { readonly string url = "http://localhost:46647/api/"; public async Task?> ObtenerPaises() { List? paises = new List(); try { using (var httpClient = new HttpClient()) { var respuesta = await httpClient.GetAsync(url + "Pais"); var respuestaString = await respuesta.Content.ReadAsStringAsync(); paises = JsonSerializer.Deserialize>(respuestaString, new JsonSerializerOptions() { PropertyNameCaseInsensitive = true }); } } catch (Exception) { throw; } return paises; } } }