public static string PostPriceForEntry(this HttpClient client, Entry entry, Price price) { var json = JsonConvert.SerializeObject(price); var requestResult = client.PostAsync($"/episerverapi/commerce/entries/{entry.Code.ToLower()}/prices", new StringContent(json, Encoding.UTF8, "application/json")).Result.Content.ReadAsStringAsync().Result; return requestResult; }
public static List<Price> GetAllPricesForEntry(this HttpClient client, Entry entry) { var requestResult = client.GetAsync($"/episerverapi/commerce/entries/{entry.Code.ToLower()}/prices") .Result.Content.ReadAsStringAsync() .Result; var result = JsonConvert.DeserializeObject<List<Price>>(requestResult); return result; }
public static string PostEntry(this HttpClient client, Entry entry) { var json = JsonConvert.SerializeObject(entry); var result = client.PostAsync("/episerverapi/commerce/entries", new StringContent(json, Encoding.UTF8, "application/json")) .Result.Content.ReadAsStringAsync() .Result; return result; }
public static string ConnectEntryToNode(this HttpClient client, Node node, Entry entry) { var model = new NodeEntryRelation() { EntryCode = entry.Code, NodeCode = node.Code, SortOrder = 0 }; var json = JsonConvert.SerializeObject(model); var result = client.PostAsync($"episerverapi/commerce/entries/{entry.Code}/nodeentryrelations", new StringContent(json, Encoding.UTF8, "application/json")) .Result.Content.ReadAsStringAsync() .Result; return result; }