Skip to content

Instantly share code, notes, and snippets.

@A2H111
Created July 2, 2017 03:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save A2H111/5b9e6d5368ba663552466d52ca39bb9b to your computer and use it in GitHub Desktop.
Save A2H111/5b9e6d5368ba663552466d52ca39bb9b to your computer and use it in GitHub Desktop.
[HttpPut]
public IHttpActionResult AddCustomer(Customer customer)
{
try
{
dbContext.Customers.Add(customer);
dbContext.SaveChanges();
return Content(HttpStatusCode.OK, "Customer" + customer.ContactName + " has been created");
}
catch (Exception ex)
{
return Content(HttpStatusCode.InternalServerError, "Inserting customer failed : " + ex.Message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment