/// <summary> /// Gets the vendor creditlist. /// </summary> /// <param name="response">The response.</param> /// <returns>VendorCreditList.</returns> internal static VendorCreditList getVendorCreditlist(HttpResponseMessage response) { var vendorCreditList = new VendorCreditList(); var jsonObject = JsonConvert.DeserializeObject<Dictionary<string, object>>(response.Content.ReadAsStringAsync().Result); if (jsonObject.ContainsKey("vendor_credits")) { var vendorCreditsArray = JsonConvert.DeserializeObject<List<object>>(jsonObject["vendor_credits"].ToString()); foreach(var vendorCreditObj in vendorCreditsArray) { var vendorCredit = new VendorCredit(); vendorCredit = JsonConvert.DeserializeObject<VendorCredit>(vendorCreditObj.ToString()); vendorCreditList.Add(vendorCredit); } } if (jsonObject.ContainsKey("page_context")) { var pageContext = new PageContext(); pageContext = JsonConvert.DeserializeObject<PageContext>(jsonObject["page_context"].ToString()); vendorCreditList.page_context = pageContext; } return vendorCreditList; }
/// <summary> /// Updates the specified vendor_credit_id. /// </summary> /// <param name="vendor_credit_id">The vendor_credit_id.</param> /// <param name="update_info">The update_info.</param> /// <returns>VendorCredit.</returns> public VendorCredit Update(string vendor_credit_id,VendorCredit update_info) { var url = baseAddress + "/" + vendor_credit_id; var json = JsonConvert.SerializeObject(update_info); var parameters = new Dictionary<object, object>(); parameters.Add("JSONString", json); var response = ZohoHttpClient.put(url, getQueryParameters(parameters)); return VendorCreditParser.getVendorCredit(response); }
/// <summary> /// Gets the vendor credit. /// </summary> /// <param name="response">The response.</param> /// <returns>VendorCredit.</returns> internal static VendorCredit getVendorCredit(HttpResponseMessage response) { var vendorCredit = new VendorCredit(); var jsonObject = JsonConvert.DeserializeObject<Dictionary<string, object>>(response.Content.ReadAsStringAsync().Result); if(jsonObject.ContainsKey("vendor_credit")) { vendorCredit = JsonConvert.DeserializeObject<VendorCredit>(jsonObject["vendor_credit"].ToString()); } return vendorCredit; }
/// <summary> /// Creates the specified new_vendor_credit_info. /// </summary> /// <param name="new_vendor_credit_info">The new_vendor_credit_info.</param> /// <param name="parameters">The parameters.</param> /// <returns>VendorCredit.</returns> public VendorCredit Create(VendorCredit new_vendor_credit_info,Dictionary<object,object> parameters) { var url = baseAddress; var json = JsonConvert.SerializeObject(new_vendor_credit_info); if (parameters == null) parameters = new Dictionary<object, object>(); parameters.Add("JSONString", json); var response = ZohoHttpClient.post(url, getQueryParameters(parameters)); return VendorCreditParser.getVendorCredit(response); }