Пример #1
0
 public ActionResult Edit([Bind(Include = "Id,Name,Active")] Student student)
 {
     if (ModelState.IsValid)
     {
         db.Entry(student).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(student));
 }
Пример #2
0
 public ActionResult Edit([Bind(Include = "Id,ClassName,StudentId")] Grade grade)
 {
     if (ModelState.IsValid)
     {
         db.Entry(grade).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.StudentId = new SelectList(db.Students, "Id", "Name", grade.StudentId);
     return(View(grade));
 }