Created
July 2, 2017 03:58
-
-
Save A2H111/5b9e6d5368ba663552466d52ca39bb9b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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