Exemple #1
0
        public async Task <IActionResult> Index()
        {
            var studentList = new List <StudentData>();
            var client      = _api.Initial();
            var res         = await client.GetAsync("api/student");

            if (res.IsSuccessStatusCode)
            {
                var results = res.Content.ReadAsStringAsync().Result;
                studentList = JsonConvert.DeserializeObject <List <StudentData> >(results);
            }

            return(View(studentList));
        }