コード例 #1
0
 public ActionResult Edit([Bind(Include = "Id,Title")] Subject subject)
 {
     if (ModelState.IsValid)
     {
         db.Entry(subject).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(subject);
 }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "Id,Name")] Teacher teacher)
 {
     if (ModelState.IsValid)
     {
         db.Entry(teacher).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(teacher));
 }