public async Task <IActionResult> Get(int attribute_id)
        {
            try
            {
                var attribute = await _attributeService.GetAttributeByIdAsync(attribute_id);

                if (attribute != null)
                {
                    return(Ok(attribute));
                }

                return(NotFound(new Error(404, "ATT_02", " attribute with this ID does not exist", "attribute_id")));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "error retrieving attribute", attribute_id);
                var error = new Error(400, "ATT_03", "error retrieving attribute", "");
                return(BadRequest(error));
            }
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Get(int attribute_id)
        {
            var attribute = await _attributeService.GetAttributeByIdAsync(attribute_id);

            return(Ok(_mapper.Map <Attribute>(attribute)));
        }