Beispiel #1
0
 public ActionResult Edit([Bind(Include = "studentID,firstName,lastName,email,studentSince")] Student student)
 {
     if (ModelState.IsValid)
     {
         db.Entry(student).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(student));
 }
 public ActionResult Edit([Bind(Include = "instructorID,firstName,lastName,subject,salary")] Instructor instructor)
 {
     if (ModelState.IsValid)
     {
         db.Entry(instructor).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(instructor));
 }
 public ActionResult Edit([Bind(Include = "courseID,description,courseStarted,studentID")] Course course)
 {
     if (ModelState.IsValid)
     {
         db.Entry(course).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.studentID = new SelectList(db.Students, "studentID", "firstName", course.studentID);
     return(View(course));
 }
Beispiel #4
0
 public ActionResult Edit([Bind(Include = "coursedetailID,price,courseID,instructorID")] CourseDetail courseDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(courseDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.courseID     = new SelectList(db.Courses, "courseID", "description", courseDetail.courseID);
     ViewBag.instructorID = new SelectList(db.Instructors, "instructorID", "firstName", courseDetail.instructorID);
     return(View(courseDetail));
 }