Example #1
0
        public void SaveCustomer()
        {
            var testCustomer = new Customer {
                Id = 5, Name = "Norman"
            };
            var isSuccessful = _service.SaveCustomer(testCustomer);

            Assert.IsTrue(isSuccessful);
        }
Example #2
0
        public async Task <IActionResult> PostCustomer([FromBody] Customer customer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _service.SaveCustomer(customer);

            return(CreatedAtAction("GetCustomer", new { id = customer.Id }, customer));
        }