Ejemplo n.º 1
0
        public async Task <IActionResult> Index()
        {
            var client = await _helper.GetClient();

            var response = await client.GetAsync("open/Product/All");

            if (response.IsSuccessStatusCode)
            {
                var json = await response.Content.ReadAsStringAsync();

                var products = JsonConvert.DeserializeObject <List <Product> >(json);

                return(View(products));
            }



            return(View());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Get(int id)
        {
            var client = await _helper.GetClient();

            var response = await client.GetAsync("open/Product/details?id=" + id);

            if (response.IsSuccessStatusCode)
            {
                var json = await response.Content.ReadAsStringAsync();

                var product = JsonConvert.DeserializeObject <Product>(json);

                return(View(product));
            }



            return(View());
        }