diff --git a/TeamDBAwesome/TeamDBAwesome/Controllers/NewCustomerController.cs b/TeamDBAwesome/TeamDBAwesome/Controllers/NewCustomerController.cs index 5d297d7..28c93c4 100644 --- a/TeamDBAwesome/TeamDBAwesome/Controllers/NewCustomerController.cs +++ b/TeamDBAwesome/TeamDBAwesome/Controllers/NewCustomerController.cs @@ -17,15 +17,24 @@ public class NewCustomerController : ApiController /// /// an instance of the customer data model /// a response with OK and the body is the new customer ID - public HttpResponseMessage Get(Customer customer) + public HttpResponseMessage Post([FromBody] Customer customer) { MySqlService dbService = new MySqlService(); - - - HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); - response.Content = new StringContent("5"); - return response; + if(ModelState.IsValid == true) + { + dbService.AddNewUser(customer); + HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); + response.Content = new StringContent("0"); + return response; + } + else + { + HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.BadRequest); + response.Content = new StringContent("Malformed Data"); + return response; + } + } }