/// <summary> /// Adds a product to the given store by id /// </summary> /// <param name="storeId"></param> /// <param name="product"></param> /// <returns></returns> public async Task<Product> AddAsync(Product product) { var requestUrl = string.Format(BaseUrl, this.StoreId); using (var client = CreateMailClient(requestUrl)) { var response = await client.PostAsJsonAsync(string.Empty, product).ConfigureAwait(false); await response.EnsureSuccessMailChimpAsync().ConfigureAwait(false); var productResponse = await response.Content.ReadAsAsync<Product>().ConfigureAwait(false); return productResponse; } }
/// <summary> /// The update async. /// </summary> /// <param name="storeId"> /// The store id. /// </param> /// <param name="store"> /// The store. /// </param> /// <returns> /// The <see cref="Task"/>. /// </returns> public async Task<Product> UpdateAsync(string productId, Product product) { //We need to delete and then readd in order to update... await this.DeleteAsync(productId).ConfigureAwait(false); return await this.AddAsync(product).ConfigureAwait(false); }