public async Task <IActionResult> IndexAsync() { IEnumerable <Game> allGames = null; var responseTask = _apiClient.SendAsync(HttpMethod.Get, ""); responseTask.Wait(); var result = responseTask.Result; if (result.IsSuccessStatusCode) { var jsonString = await result.Content.ReadAsStringAsync(); allGames = JsonConvert.DeserializeObject <List <Game> >(jsonString); } else //web api sent error response { //log response status here.. allGames = Enumerable.Empty <Game>(); ModelState.AddModelError(string.Empty, "Server error. Please contact administrator."); } return(View("Index", allGames)); }