code_junkie

Updating a disconnected LINQ object with MVC Framework RC1

Nov 14th, 2011
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. datacontext.customers.Attach(customer);
  2.  
  3. public ActionResult MySaveAction(int id, FormCollection form)
  4. {
  5. Customer updateCustomer = _Repository.GetCustomer(id);
  6.  
  7. TryUpdateModel(updateCustomer, "Customer", form);
  8.  
  9. _Repository.Save(updateCustomer);
  10. }
Add Comment
Please, Sign In to add comment