コード例 #1
0
 public ActionResult Edit([Bind(Include = "StudentId,FirstName,SecondName")] 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 = "SubjectId,SubjectName")] Subject subject)
 {
     if (ModelState.IsValid)
     {
         db.Entry(subject).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(subject));
 }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "LecturerID,LecturerName")] Lecturer lecturer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(lecturer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(lecturer));
 }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "StudentID,StudentFName,StudentLName")] Student student)
 {
     if (ModelState.IsValid)
     {
         db.Entry(student).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.StudentID = new SelectList(db.StudentSubjects, "StudentID", "StudentID", student.StudentID);
     return(View(student));
 }
コード例 #5
0
 public ActionResult Edit([Bind(Include = "AttendanceId,AttendanceDate,SubjectId,StudentId,Present")] Attendance attendance)
 {
     if (ModelState.IsValid)
     {
         db.Entry(attendance).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.StudentId = new SelectList(db.Students, "StudentId", "FirstName", attendance.StudentId);
     ViewBag.SubjectId = new SelectList(db.Subjects, "SubjectId", "SubjectName", attendance.SubjectId);
     return(View(attendance));
 }