Exemplo n.º 1
0
        public Product Get(int id)
        {
            if (id <= 1)
            {
                //throw new InvalidProgramException("id should bigger than one");
                _logger.LogInformation("Error: id should bigger than one");
                return(null);
            }
            var product = _productRepository.Get(id);

            if (product == null)
            {
                _logger.LogInformation("Unable to Retrieved a product with Id: {Id}", id);
                return(null);
            }
            _logger.LogInformation("Retrieved a product with Id: {Id}", id);
            return(product);
        }