Exemplo n.º 1
0
        public async Task <ActionResult> GetProduct(string id)
        {
            var product = await _productRepositories.GetProduct(id);

            if (product == null)
            {
                _logger.LogError($"Product id: {id}, not found");
                return(NotFound());
            }

            return(Ok(product));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> GetAllProduct()
        {
            try
            {
                var categories = await _ProductRepositories.GetProduct();

                if (categories == null)
                {
                    return(NotFound());
                }

                return(Ok(categories));
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }