Exemplo n.º 1
0
        public ActionResult <Product> DeleteProduct(string productName)
        {
            productName = productName.Trim();
            var product = repo.FindProduct(productName);

            if (product == null)
            {
                logger.LogInformation($"{DateTime.Now} DELETE: api/product/{productName} > NotFound");
                return(NotFound());
            }
            repo.RemoveProduct(product);
            logger.LogInformation($"{DateTime.Now} DELETE: api/product/{productName} > {product}");
            Thread.Sleep(2000);

            return(product);
        }