Advertisement
Ludwiq

Editing Collection

Feb 28th, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.49 KB | None | 0 0
  1. [HttpPost]
  2.         [ValidateAntiForgeryToken]
  3.         public ActionResult Edit([Bind(Include = "Name,Notes")] Collection collection, int LanguageID)
  4.         {
  5.             if (ModelState.IsValid)
  6.             {
  7.                 collection.Language = db.Languages.Find(LanguageID);
  8.                 db.Entry(collection).State = EntityState.Modified;
  9.                 db.SaveChanges();
  10.                 return RedirectToAction("Index");
  11.             }
  12.             return View(collection);
  13.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement