Created
April 8, 2017 04:43
-
-
Save A2H111/9c377dd6bfed87b5c5651f3afe7ff80e 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
//Creating dbcontext class for NorthwindDatabase | |
NorthwindEntities dbContext = new NorthwindEntities(); | |
[HttpPost] | |
public IHttpActionResult UpdateCustomer(Customer customer) | |
{ | |
try | |
{ | |
//Code to Save the data | |
dbContext.Entry(customer).State = System.Data.EntityState.Modified; | |
dbContext.SaveChanges(); | |
//Return Ok response if data saved successfully | |
return Content(HttpStatusCode.OK, "Data Saved Successfully"); | |
} | |
catch (Exception ex) | |
{ | |
return Content(HttpStatusCode.InternalServerError, "Data Save Failed" + ex.Message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment