Esempio n. 1
0
        public async Task <ProductSingle> GetProducto(string code)
        {
            string json = string.Empty;


            HttpClient          client   = new HttpClient();
            string              url      = string.Format("{0}{1}.json", $"https://angurlar-html-default-rtdb.firebaseio.com/productos/", code);
            HttpResponseMessage response = await client.GetAsync(url);

            response.EnsureSuccessStatusCode();
            string responseBody = await response.Content.ReadAsStringAsync();

            ProductSingle result = Newtonsoft.Json.JsonConvert.DeserializeObject <ProductSingle>(responseBody);

            return(result);
        }
Esempio n. 2
0
 protected async override Task OnInitializedAsync()
 {
     producto = await GetProducto(cod);
 }