public async Task <IActionResult> GetAttributeValueByProductId(int product_id)
        {
            try
            {
                var product = await _productService.GetProductByIdAsync(product_id);

                if (product == null)
                {
                    return(NotFound(new Error(404, "PRD_02", " product with this ID does not exist", "product_id")));
                }

                var values = await _attributeService.GetAttributeValueByProductIdAsync(product_id);

                return(Ok(values));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "error retrieving product attribute values", product_id);
                var error = new Error(400, "ATT_03", "error retrieving product attribute values", "");
                return(BadRequest(error));
            }
        }
        public async Task <IActionResult> GetAttributeValueByProductId(int product_id)
        {
            var attributes = await _attributeService.GetAttributeValueByProductIdAsync(product_id);

            return(Ok(_mapper.Map <List <ProductAttributeValue> >(attributes)));
        }
Beispiel #3
0
        public async Task <IActionResult> GetAttributeValueByProductId(int product_id)
        {
            var attribute = await _attributeService.GetAttributeValueByProductIdAsync(product_id);

            return(Ok(attribute));
        }