コード例 #1
0
        public ActionResult Create(CmStudentCourse cmstudentcourse)
        {
            if (ModelState.IsValid)
            {
                context.CmStudentCourses.Add(cmstudentcourse);
                context.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.PossiblecmStudents = context.CmStudents;
            ViewBag.PossibleclSubjects = context.ClSubjects;
            ViewBag.PossiblecmTeachers = context.CmTeachers;
            return View(cmstudentcourse);
        }
コード例 #2
0
 public ActionResult Edit(CmStudentCourse cmstudentcourse)
 {
     if (ModelState.IsValid)
     {
         context.Entry(cmstudentcourse).State = EntityState.Modified;
         context.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.PossiblecmStudents = context.CmStudents;
     ViewBag.PossibleclSubjects = context.ClSubjects;
     ViewBag.PossiblecmTeachers = context.CmTeachers;
     return View(cmstudentcourse);
 }