示例#1
0
        /// <summary>
        ///     Updates the given <see cref="ProductMetaDataModel" />.
        /// </summary>
        /// <param name="productId">The  product id of the product.</param>
        /// <param name="metaDataTypeId">The  meta data type id of the product.</param>
        /// <param name="model">The <see cref="ProductMetaDataModel" /> to update.</param>
        /// <returns>The updated <see cref="ProductMetaDataModel" />.</returns>
        public virtual async Task <ProductMetaDataModel> UpdateAsync(int productId, int metaDataTypeId,
                                                                     ProductMetaDataModel model)
        {
            var req     = PrepareRequest($"products/{productId}/meta-data/{metaDataTypeId}");
            var body    = model.ToDictionary();
            var content = new JsonContent(body);

            return(await ExecuteRequestAsync <ProductMetaDataModel>(req, HttpMethod.Put, content, "data"));
        }
        /// <summary>
        ///     Updates the given <see cref="ProductLanguageModel" />.
        /// </summary>
        /// <param name="productId">The  product id of the product.</param>
        /// <param name="langCode">The language code of the product.</param>
        /// <param name="model">The <see cref="ProductLanguageModel" /> to update.</param>
        /// <returns>The updated <see cref="ProductLanguageModel" />.</returns>
        public virtual async Task <ProductLanguageModel> UpdateAsync(int productId, string langCode,
                                                                     ProductMetaDataModel model)
        {
            var req     = PrepareRequest($"products/{productId}/languages/{langCode}");
            var body    = model.ToDictionary();
            var content = new JsonContent(body);

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