Exemplo n.º 1
0
        public void SaveProduct()
        {
            var testProduct = new Product {
                Id = 8, Description = "Wipes", Price = 5.75
            };
            var isSuccessful = _service.SaveProduct(testProduct);

            Assert.IsTrue(isSuccessful);
        }
        public async Task <IActionResult> PostProduct([FromBody] Product product)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _service.SaveProduct(product);

            return(CreatedAtAction("GetProduct", new { id = product.Id }, product));
        }