//GET: BandList public async Task <IActionResult> BandList(int?id) { if (id == null) { return(HttpNotFound()); } SongResponseBandList resSongs1 = new SongResponseBandList(); await Task.Run(() => { var task1 = HttpReqProxy.GetBandListAsync(id.Value); resSongs1 = task1.GetAwaiter().GetResult(); // http请求返回错误 if (resSongs1.showapi_res_code == -1) { throw new HttpRequestException(resSongs1.showapi_res_error); } }); SongFileManager.SetSongListByBand(WebSongs, resSongs1.showapi_res_body.pagebean.songlist); ViewData["rankname"] = RankNameFromId(id.Value); return(View(WebSongs)); }
public async Task <IActionResult> Index() { SongResponseBandList resSongs1 = new SongResponseBandList(); SongResponseBandList resSongs2 = new SongResponseBandList(); SongResponseBandList resSongs3 = new SongResponseBandList(); await Task.Run(() => { var task1 = HttpReqProxy.GetBandListAsync(5); //内地 resSongs1 = task1.GetAwaiter().GetResult(); // http请求返回错误 if (resSongs1.showapi_res_code == -1) { throw new HttpRequestException(resSongs1.showapi_res_error); } var task2 = HttpReqProxy.GetBandListAsync(5); //内地 resSongs2 = task2.GetAwaiter().GetResult(); // http请求返回错误 if (resSongs2.showapi_res_code == -1) { throw new HttpRequestException(resSongs2.showapi_res_error); } var task3 = HttpReqProxy.GetBandListAsync(5); //内地 resSongs3 = task3.GetAwaiter().GetResult(); // http请求返回错误 if (resSongs3.showapi_res_code == -1) { throw new HttpRequestException(resSongs3.showapi_res_error); } }); SongFileManager.SetSongListByBand(homeSongDb.Band1List, resSongs1.showapi_res_body.pagebean.songlist); SongFileManager.SetSongListByBand(homeSongDb.Band2List, resSongs2.showapi_res_body.pagebean.songlist); SongFileManager.SetSongListByBand(homeSongDb.Band3List, resSongs3.showapi_res_body.pagebean.songlist); return(View(homeSongDb)); }