private SummaryModel GetSummaryModel() { HttpClient httpClient = ApiHttpClient.GetHttpClient(); HttpResponseMessage response = httpClient.GetAsync("api/cumulative").Result; if (!response.IsSuccessStatusCode) { return(null); } string responseContent = response.Content.ReadAsStringAsync().Result; return(JsonConvert.DeserializeObject <SummaryModel>(responseContent)); }
public JsonResult GetCaTimelineModel(int caId) { HttpClient httpClient = ApiHttpClient.GetHttpClient(); HttpResponseMessage response = httpClient.GetAsync($"api/xspeditionapi/catimeline/{caId}").Result; if (!response.IsSuccessStatusCode) { return(Json(new { Error = "Data Not retrieved successfully." }, JsonRequestBehavior.AllowGet));; } string responseContent = response.Content.ReadAsStringAsync().Result; CaTimelineViewModel caTimeline = JsonConvert.DeserializeObject <CaTimelineViewModel>(responseContent); return(Json(caTimeline, JsonRequestBehavior.AllowGet)); }