/// <summary> /// Gets the purchaseorder list. /// </summary> /// <param name="response">The response.</param> /// <returns>PurchaseorderList.</returns> internal static PurchaseorderList getPurchaseorderList(HttpResponseMessage response) { var purchaseorderList = new PurchaseorderList(); var jsonObject = JsonConvert.DeserializeObject <Dictionary <string, object> >(response.Content.ReadAsStringAsync().Result); if (jsonObject.ContainsKey("purchaseorders")) { var purchaseordersArray = JsonConvert.DeserializeObject <List <object> >(jsonObject["purchaseorders"].ToString()); foreach (var purchaseorderObj in purchaseordersArray) { var purchaseorder = new Purchaseorder(); purchaseorder = JsonConvert.DeserializeObject <Purchaseorder>(purchaseorderObj.ToString()); purchaseorderList.Add(purchaseorder); } } if (jsonObject.ContainsKey("page_context")) { var pageContext = new PageContext(); pageContext = JsonConvert.DeserializeObject <PageContext>(jsonObject["page_context"].ToString()); purchaseorderList.page_context = pageContext; } return(purchaseorderList); }
/// <summary> /// Gets the purchaseorder list. /// </summary> /// <param name="response">The response.</param> /// <returns>PurchaseorderList.</returns> internal static PurchaseorderList getPurchaseorderList(HttpResponseMessage response) { var purchaseorderList = new PurchaseorderList(); var jsonObject = JsonConvert.DeserializeObject<Dictionary<string, object>>(response.Content.ReadAsStringAsync().Result); if (jsonObject.ContainsKey("purchaseorders")) { var purchaseordersArray = JsonConvert.DeserializeObject<List<object>>(jsonObject["purchaseorders"].ToString()); foreach (var purchaseorderObj in purchaseordersArray) { var purchaseorder = new Purchaseorder(); purchaseorder = JsonConvert.DeserializeObject<Purchaseorder>(purchaseorderObj.ToString()); purchaseorderList.Add(purchaseorder); } } if (jsonObject.ContainsKey("page_context")) { var pageContext = new PageContext(); pageContext = JsonConvert.DeserializeObject<PageContext>(jsonObject["page_context"].ToString()); purchaseorderList.page_context = pageContext; } return purchaseorderList; }