public async Task<ActionResult> GetCustomerQuoteRequests() { var criteria = WorkContext.CurrentQuoteSearchCriteria; var quoteSearchCriteria = new VirtoCommerceDomainQuoteModelQuoteRequestSearchCriteria { Start = criteria.Start, Count = criteria.PageSize, StoreId = WorkContext.CurrentStore.Id, CustomerId = WorkContext.CurrentCustomer.Id, }; var searchResult = await _quoteApi.QuoteModuleSearchAsync(quoteSearchCriteria); if (searchResult != null) { WorkContext.CurrentCustomer.QuoteRequests = new StorefrontPagedList<QuoteRequest>( searchResult.QuoteRequests.Select(x => x.ToWebModel(WorkContext.AllCurrencies, WorkContext.CurrentLanguage)), criteria.PageNumber, criteria.PageSize, searchResult.TotalCount.Value, page => WorkContext.RequestUrl.SetQueryParameter("page", page.ToString()).ToString()); } return View("customers/quote-requests", WorkContext); }
/// <summary> /// Search RFQ by given criteria /// </summary> /// <exception cref="VirtoCommerce.Client.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="criteria">criteria</param> /// <returns>Task of ApiResponse (VirtoCommerceQuoteModuleWebModelQuoteRequestSearchResult)</returns> public async System.Threading.Tasks.Task<ApiResponse<VirtoCommerceQuoteModuleWebModelQuoteRequestSearchResult>> QuoteModuleSearchAsyncWithHttpInfo (VirtoCommerceDomainQuoteModelQuoteRequestSearchCriteria criteria) { // verify the required parameter 'criteria' is set if (criteria == null) throw new ApiException(400, "Missing required parameter 'criteria' when calling QuoteModuleApi->QuoteModuleSearch"); var localVarPath = "/api/quote/requests/search"; 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 (criteria.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(criteria); // http body (model) parameter } else { localVarPostBody = criteria; // 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 QuoteModuleSearch: " + localVarResponse.Content, localVarResponse.Content); else if (localVarStatusCode == 0) throw new ApiException (localVarStatusCode, "Error calling QuoteModuleSearch: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); return new ApiResponse<VirtoCommerceQuoteModuleWebModelQuoteRequestSearchResult>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (VirtoCommerceQuoteModuleWebModelQuoteRequestSearchResult) Configuration.ApiClient.Deserialize(localVarResponse, typeof(VirtoCommerceQuoteModuleWebModelQuoteRequestSearchResult))); }
/// <summary> /// Search RFQ by given criteria /// </summary> /// <exception cref="VirtoCommerce.Client.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="criteria">criteria</param> /// <returns>Task of VirtoCommerceQuoteModuleWebModelQuoteRequestSearchResult</returns> public async System.Threading.Tasks.Task<VirtoCommerceQuoteModuleWebModelQuoteRequestSearchResult> QuoteModuleSearchAsync (VirtoCommerceDomainQuoteModelQuoteRequestSearchCriteria criteria) { ApiResponse<VirtoCommerceQuoteModuleWebModelQuoteRequestSearchResult> localVarResponse = await QuoteModuleSearchAsyncWithHttpInfo(criteria); return localVarResponse.Data; }
/// <summary> /// Search RFQ by given criteria /// </summary> /// <exception cref="VirtoCommerce.Client.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="criteria">criteria</param> /// <returns>VirtoCommerceQuoteModuleWebModelQuoteRequestSearchResult</returns> public VirtoCommerceQuoteModuleWebModelQuoteRequestSearchResult QuoteModuleSearch (VirtoCommerceDomainQuoteModelQuoteRequestSearchCriteria criteria) { ApiResponse<VirtoCommerceQuoteModuleWebModelQuoteRequestSearchResult> localVarResponse = QuoteModuleSearchWithHttpInfo(criteria); return localVarResponse.Data; }
/// <summary> /// Search RFQ by given criteria /// </summary> /// <param name="criteria">criteria</param> /// <returns>Task of ApiResponse (VirtoCommerceQuoteModuleWebModelQuoteRequestSearchResult)</returns> public async System.Threading.Tasks.Task<ApiResponse<VirtoCommerceQuoteModuleWebModelQuoteRequestSearchResult>> QuoteModuleSearchAsyncWithHttpInfo (VirtoCommerceDomainQuoteModelQuoteRequestSearchCriteria criteria) { // verify the required parameter 'criteria' is set if (criteria == null) throw new ApiException(400, "Missing required parameter 'criteria' when calling QuoteModuleSearch"); var path_ = "/api/quote/requests/search"; 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(criteria); // 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 QuoteModuleSearch: " + response.Content, response.Content); else if (statusCode == 0) throw new ApiException (statusCode, "Error calling QuoteModuleSearch: " + response.ErrorMessage, response.ErrorMessage); return new ApiResponse<VirtoCommerceQuoteModuleWebModelQuoteRequestSearchResult>(statusCode, response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (VirtoCommerceQuoteModuleWebModelQuoteRequestSearchResult) Configuration.ApiClient.Deserialize(response, typeof(VirtoCommerceQuoteModuleWebModelQuoteRequestSearchResult))); }