Advertisement
Guest User

Untitled

a guest
Aug 1st, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. public ActionResult Edit(int id, User source)
  2. {
  3. User existing = db.Users.Single(x => x.Id == id);
  4.  
  5. if (existing != null)
  6. {
  7. existing.Username = source.Username;
  8. existing.EmailAddress = source.EmailAddress;
  9. existing.Password = source.Password;
  10.  
  11. db.Entry(existing).State = System.Data.Entity.EntityState.Modified;
  12. db.SaveChanges();
  13.  
  14. return View("Index");
  15. }
  16. else
  17. {
  18. // report user not found
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement