/// <summary> /// /// </summary> /// <param name="customer"></param> /// <returns></returns> public async Task <PromoRule> AddAsync(PromoRule customer) { var requestUrl = string.Format(BaseUrl, StoreId); using (var client = CreateMailClient(requestUrl)) { var response = await client.PostAsJsonAsync(string.Empty, customer).ConfigureAwait(false); await response.EnsureSuccessMailChimpAsync().ConfigureAwait(false); var promoRuleResponse = await response.Content.ReadAsAsync <PromoRule>().ConfigureAwait(false); return(promoRuleResponse); } }
/// <summary> /// The update async. /// </summary> /// <param name="cartId"></param> /// <param name="cart"></param> /// <returns> /// The <see cref="Task"/>. /// </returns> public async Task <PromoRule> UpdateAsync(string promoRuleID, PromoRule promoRule) { var requestUrl = string.Format(BaseUrl, StoreId); using (var client = CreateMailClient(requestUrl + "/")) { var response = await client.PatchAsJsonAsync(promoRuleID, promoRule).ConfigureAwait(false); await response.EnsureSuccessMailChimpAsync().ConfigureAwait(false); var promoRuleResponse = await response.Content.ReadAsAsync <PromoRule>().ConfigureAwait(false); return(promoRuleResponse); } }