Ejemplo n.º 1
0
        public async Task <APIResponse> GetProductquantitys(ProductquantityParameters productquantityParameters)
        {
            try
            {
                var client = httpClientFactory.CreateClient(ECommerceServiceOperation.serviceName);

                UriBuilder url = new UriBuilder(servicesConfig.ECommerce + ECommerceServiceOperation.GetProductQuantities());
                url.Query = QueryStringHelper.ConvertToQueryString(productquantityParameters);

                var response = await client.GetAsync(url.ToString());

                if (response.IsSuccessStatusCode)
                {
                    var multicode = JsonConvert.DeserializeObject <List <ProductquantityResponse> >(await response.Content.ReadAsStringAsync());
                    return(new APIResponse(multicode, HttpStatusCode.OK));
                }

                return(new APIResponse(response.StatusCode));
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception in method 'GetMultiDetails()'");
                var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                return(new APIResponse(exMessage, HttpStatusCode.InternalServerError));
            }
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> GetProductquantitys([FromQuery] ProductquantityParameters productquantityParameters)
        {
            var result = await productquantityService.GetProductquantitys(productquantityParameters);

            return(StatusCode((int)result.Code, result.Value));
        }