Skip to content

Commit

Permalink
finalizing add cutsomer API
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Mill committed Nov 11, 2015
1 parent ccc7644 commit a1863c6
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions TeamDBAwesome/TeamDBAwesome/Controllers/NewCustomerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,24 @@ public class NewCustomerController : ApiController
/// </summary>
/// <param name="customer">an instance of the customer data model</param>
/// <returns>a response with OK and the body is the new customer ID</returns>
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;
}

}

}
Expand Down

0 comments on commit a1863c6

Please sign in to comment.