Example #1
0
 public ActionResult Edit([Bind(Include = "TeacherId,Name")] Teacher teacher)
 {
     if (ModelState.IsValid)
     {
         db.Entry(teacher).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(teacher));
 }
Example #2
0
 public ActionResult Edit([Bind(Include = "StudentID,LastName,FirstName,EnrollmentDate,Phone")] Student student)
 {
     if (ModelState.IsValid)
     {
         db.Entry(student).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(student));
 }
Example #3
0
 public ActionResult Edit([Bind(Include = "CustomerID,FirstName,LastName,Phone")] Customer customer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(customer));
 }
Example #4
0
 public ActionResult Edit([Bind(Include = "CourseID,Title,Credits")] Course course)
 {
     if (ModelState.IsValid)
     {
         db.Entry(course).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(course));
 }
Example #5
0
 public ActionResult Edit([Bind(Include = "EnrollmentID,Grade,CourseID,StudentID")] Enrollment enrollment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(enrollment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CourseID  = new SelectList(db.Courses, "CourseID", "Title", enrollment.CourseID);
     ViewBag.StudentID = new SelectList(db.Students, "StudentID", "LastName", enrollment.StudentID);
     return(View(enrollment));
 }