Ejemplo n.º 1
0
        // GET: Request
        public async Task <IActionResult> Index()
        {
            List <RequestViewModel> requests = new List <RequestViewModel>();
            HttpClient          client       = _api.Initial();
            HttpResponseMessage res          = await client.GetAsync("orders");

            if (res.IsSuccessStatusCode)
            {
                var result = res.Content.ReadAsStringAsync().Result;
                requests = JsonConvert.DeserializeObject <List <RequestViewModel> >(result);
            }

            return(View(requests));
        }