Example #1
0
        /// <summary>
        /// Creates a new <see cref="ProductManufacturerModel"/> on the store.
        /// </summary>
        /// <param name="product">A new <see cref="ProductManufacturerModel"/>. Id should be set to null.</param>
        /// <returns>The new <see cref="ProductManufacturerModel"/>.</returns>
        public virtual async Task <ProductManufacturerModel> CreateAsync(ProductManufacturerModel product)
        {
            var req     = PrepareRequest("product-manufacturers");
            var body    = product.ToDictionary();
            var content = new JsonContent(body);

            return(await ExecuteRequestAsync <ProductManufacturerModel>(req, HttpMethod.Post, content, "data"));
        }
Example #2
0
        // <summary>
        /// Updates the given <see cref="ProductManufacturerModel"/>.
        /// </summary>
        /// <param name="manufacturerId">Id of the object being updated.</param>
        /// <param name="product">The <see cref="ProductManufacturerModel"/> to update.</param>
        /// <returns>The updated <see cref="ProductManufacturerModel"/>.</returns>
        public virtual async Task <ProductManufacturerModel> PatchAsync(int manufacturerId, ProductManufacturerModel product)
        {
            var req     = PrepareRequest($"product-manufacturers/{manufacturerId}");
            var body    = product.ToDictionary();
            var content = new JsonContent(body);

            return(await ExecuteRequestAsync <ProductManufacturerModel>(req, HttpMethod.Patch, content, "data"));
        }