public static Pricelist ToWebModel(this VirtoCommercePricingModuleWebModelPricelist pricelist) { var result = new Pricelist { Id = pricelist.Id, Currency = pricelist.Currency, }; return(result); }
/// <summary> /// Create pricelist /// </summary> /// <param name="priceList"></param> /// <returns>Task of ApiResponse (VirtoCommercePricingModuleWebModelPricelist)</returns> public async System.Threading.Tasks.Task<ApiResponse<VirtoCommercePricingModuleWebModelPricelist>> PricingModuleCreatePriceListAsyncWithHttpInfo (VirtoCommercePricingModuleWebModelPricelist priceList) { // verify the required parameter 'priceList' is set if (priceList == null) throw new ApiException(400, "Missing required parameter 'priceList' when calling PricingModuleCreatePriceList"); var path_ = "/api/pricing/pricelists"; var pathParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>(); var fileParams = new Dictionary<String, FileParameter>(); String postBody = null; // to determine the Accept header String[] http_header_accepts = new String[] { "application/json", "text/json" }; String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts); if (http_header_accept != null) headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts)); // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json pathParams.Add("format", "json"); postBody = Configuration.ApiClient.Serialize(priceList); // http body (model) parameter // make the HTTP request IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams); int statusCode = (int) response.StatusCode; if (statusCode >= 400) throw new ApiException (statusCode, "Error calling PricingModuleCreatePriceList: " + response.Content, response.Content); else if (statusCode == 0) throw new ApiException (statusCode, "Error calling PricingModuleCreatePriceList: " + response.ErrorMessage, response.ErrorMessage); return new ApiResponse<VirtoCommercePricingModuleWebModelPricelist>(statusCode, response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (VirtoCommercePricingModuleWebModelPricelist) Configuration.ApiClient.Deserialize(response, typeof(VirtoCommercePricingModuleWebModelPricelist))); }
/// <summary> /// Create pricelist /// </summary> /// <param name="priceList"></param> /// <returns>Task of VirtoCommercePricingModuleWebModelPricelist</returns> public async System.Threading.Tasks.Task<VirtoCommercePricingModuleWebModelPricelist> PricingModuleCreatePriceListAsync (VirtoCommercePricingModuleWebModelPricelist priceList) { ApiResponse<VirtoCommercePricingModuleWebModelPricelist> response = await PricingModuleCreatePriceListAsyncWithHttpInfo(priceList); return response.Data; }
/// <summary> /// Create pricelist /// </summary> /// <param name="priceList"></param> /// <returns>VirtoCommercePricingModuleWebModelPricelist</returns> public VirtoCommercePricingModuleWebModelPricelist PricingModuleCreatePriceList (VirtoCommercePricingModuleWebModelPricelist priceList) { ApiResponse<VirtoCommercePricingModuleWebModelPricelist> response = PricingModuleCreatePriceListWithHttpInfo(priceList); return response.Data; }
/// <summary> /// Update pricelist /// </summary> /// <param name="priceList"></param> /// <returns>Task of void</returns> public async System.Threading.Tasks.Task PricingModuleUpdatePriceListAsync (VirtoCommercePricingModuleWebModelPricelist priceList) { await PricingModuleUpdatePriceListAsyncWithHttpInfo(priceList); }
/// <summary> /// Update pricelist /// </summary> /// <param name="priceList"></param> /// <returns></returns> public void PricingModuleUpdatePriceList (VirtoCommercePricingModuleWebModelPricelist priceList) { PricingModuleUpdatePriceListWithHttpInfo(priceList); }
/// <summary> /// Update prices Update prices of product for given pricelist. /// </summary> /// <param name="productId">Product id</param> /// <param name="priceList">Pricelist with new product prices</param> /// <returns>ApiResponse of Object(void)</returns> public ApiResponse<Object> PricingModuleUpdateProductPriceListsWithHttpInfo (string productId, VirtoCommercePricingModuleWebModelPricelist priceList) { // verify the required parameter 'productId' is set if (productId == null) throw new ApiException(400, "Missing required parameter 'productId' when calling PricingModuleUpdateProductPriceLists"); // verify the required parameter 'priceList' is set if (priceList == null) throw new ApiException(400, "Missing required parameter 'priceList' when calling PricingModuleUpdateProductPriceLists"); var path_ = "/api/catalog/products/{productId}/pricelists"; var pathParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>(Configuration.DefaultHeader); var formParams = new Dictionary<String, String>(); var fileParams = new Dictionary<String, FileParameter>(); String postBody = null; // to determine the Accept header String[] http_header_accepts = new String[] { }; String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts); if (http_header_accept != null) headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts)); // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json pathParams.Add("format", "json"); if (productId != null) pathParams.Add("productId", Configuration.ApiClient.ParameterToString(productId)); // path parameter postBody = Configuration.ApiClient.Serialize(priceList); // http body (model) parameter // make the HTTP request IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams); int statusCode = (int) response.StatusCode; if (statusCode >= 400) throw new ApiException (statusCode, "Error calling PricingModuleUpdateProductPriceLists: " + response.Content, response.Content); else if (statusCode == 0) throw new ApiException (statusCode, "Error calling PricingModuleUpdateProductPriceLists: " + response.ErrorMessage, response.ErrorMessage); return new ApiResponse<Object>(statusCode, response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), null); }
/// <summary> /// Update prices Update prices of product for given pricelist. /// </summary> /// <param name="productId">Product id</param> /// <param name="priceList">Pricelist with new product prices</param> /// <returns></returns> public void PricingModuleUpdateProductPriceLists (string productId, VirtoCommercePricingModuleWebModelPricelist priceList) { PricingModuleUpdateProductPriceListsWithHttpInfo(productId, priceList); }
/// <summary> /// Create pricelist /// </summary> /// <exception cref="VirtoCommerce.Client.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="priceList"></param> /// <returns>Task of ApiResponse (VirtoCommercePricingModuleWebModelPricelist)</returns> public async System.Threading.Tasks.Task<ApiResponse<VirtoCommercePricingModuleWebModelPricelist>> PricingModuleCreatePriceListAsyncWithHttpInfo (VirtoCommercePricingModuleWebModelPricelist priceList) { // verify the required parameter 'priceList' is set if (priceList == null) throw new ApiException(400, "Missing required parameter 'priceList' when calling PricingModuleApi->PricingModuleCreatePriceList"); var localVarPath = "/api/pricing/pricelists"; var localVarPathParams = new Dictionary<String, String>(); var localVarQueryParams = new Dictionary<String, String>(); var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader); var localVarFormParams = new Dictionary<String, String>(); var localVarFileParams = new Dictionary<String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { "application/json", "text/json", "application/xml", "text/xml", "application/x-www-form-urlencoded" }; String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json", "text/json", "application/xml", "text/xml" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); if (priceList.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(priceList); // http body (model) parameter } else { localVarPostBody = priceList; // byte array } // make the HTTP request IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int) localVarResponse.StatusCode; if (localVarStatusCode >= 400 && (localVarStatusCode != 404 || Configuration.ThrowExceptionWhenStatusCodeIs404)) throw new ApiException (localVarStatusCode, "Error calling PricingModuleCreatePriceList: " + localVarResponse.Content, localVarResponse.Content); else if (localVarStatusCode == 0) throw new ApiException (localVarStatusCode, "Error calling PricingModuleCreatePriceList: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); return new ApiResponse<VirtoCommercePricingModuleWebModelPricelist>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (VirtoCommercePricingModuleWebModelPricelist) Configuration.ApiClient.Deserialize(localVarResponse, typeof(VirtoCommercePricingModuleWebModelPricelist))); }