Exemple #1
0
        public async Task <ListProductModelSearchDTO> ShopmanSearchModel(int?productCategoryId, int?productTypeId, int?manufactoryId, string search = "")
        {
            var result = await _repoWrapper.ProductModel.ShopmanSearchProductModel(productCategoryId, productTypeId, manufactoryId, search);

            var output = new ListProductModelSearchDTO();

            output.Data = _mapper.Map <IEnumerable <ProductModel_SearchByCategory_Result_DTO> >(result);
            return(output);
        }
        public async Task <ListProductModelSearchDTO> SearchProductModels(int?productCategoryId, int?productTypeId, int?manufactoryId, string search)
        {
            var    output       = new ListProductModelSearchDTO();
            string apiUrl       = $"/api/v1/ProductModel/Search";
            string paramRequest = $"?productCategoryId={productCategoryId}&productTypeId={productTypeId}&manufactoryId={manufactoryId}&search={search}";
            var    response     = await _client.GetAsync(apiUrl + paramRequest);

            if (response.IsSuccessStatusCode)
            {
                string responseStream = await response.Content.ReadAsStringAsync();

                output = JsonConvert.DeserializeObject <ListProductModelSearchDTO>(responseStream);
            }
            return(output);
        }
Exemple #3
0
        public async Task <ListProductModelSearchDTO> GetListModelByManu(int?manufactoryId, int?ProductCategoryId, string keyword = "")
        {
            ListProductModelSearchDTO output = new ListProductModelSearchDTO();
            string apiUrl       = $"/api/v1/ProductModel/ShopmanSearchModel";
            string paramRequest = "";

            if (String.IsNullOrEmpty(keyword))
            {
                paramRequest = $"?manufactoryId={manufactoryId}&productCategoryId={ProductCategoryId}";
            }
            else
            {
                paramRequest = $"?manufactoryId={manufactoryId}&productCategoryId={ProductCategoryId}&search={keyword}";
            }
            var response = await _client.GetAsync(apiUrl + paramRequest);

            if (response.IsSuccessStatusCode)
            {
                string responseStream = await response.Content.ReadAsStringAsync();

                output = JsonConvert.DeserializeObject <ListProductModelSearchDTO>(responseStream);
            }
            return(output);
        }