示例#1
0
        public async Task <IActionResult> Index(string id)
        {
            ItunesRepository ir = new ItunesRepository();

            ViewModels.RootObject iv = await ir.GetItnesInfo(id);

            return(View(iv));
        }
示例#2
0
        public async Task <ViewModels.RootObject> GetItnesInfo(string id)
        {
            client.DefaultRequestHeaders.Clear();

            string url = client.BaseAddress + "?id=" + id;
            HttpResponseMessage res = await client.GetAsync(url);

            var jwt = res.Content.ReadAsStringAsync().Result;

            ViewModels.RootObject itunesViewClass = JsonConvert.DeserializeObject <ViewModels.RootObject>(jwt);

            return(itunesViewClass);
        }