Guest User

Untitled

a guest
Jun 20th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. [AcceptVerbs(HttpVerbs.Post)]
  2. public ActionResult Edit(Contact contactToEdit) {
  3. if (!ModelState.IsValid)
  4. return View();
  5.  
  6. try {
  7. var originalContact = (from c in base._entities.ContactSet
  8. where c.Id == contactToEdit.Id
  9. select c).First();
  10. base._entities.ApplyPropertyChanges(originalContact.EntityKey.EntitySetName, contactToEdit);
  11. base._entities.SaveChanges();
  12.  
  13. return RedirectToAction("Index");
  14. } catch(Exception e) {
  15. return View();
  16. }
  17. }
  18.  
  19. System.Data.Objects.ObjectStateEntry x = base._entities.ObjectStateManager.GetObjectStateEntry(originalContact);
Add Comment
Please, Sign In to add comment