Ejemplo n.º 1
0
        public ActionResult Create(Semestercourses semestercourses)
        {
            if (ModelState.IsValid)
            {
                db.SemesterCourses.Add(semestercourses);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.SemesterID = new SelectList(db.Semesters, "SemesterID", "Name", semestercourses.SemesterID);
            ViewBag.CourseID = new SelectList(db.Courses, "CourseID", "Name", semestercourses.CourseID);
            return View(semestercourses);
        }
Ejemplo n.º 2
0
 public ActionResult Edit(Semestercourses semestercourses)
 {
     if (ModelState.IsValid)
     {
         db.Entry(semestercourses).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.SemesterID = new SelectList(db.Semesters, "SemesterID", "Name", semestercourses.SemesterID);
     ViewBag.CourseID = new SelectList(db.Courses, "CourseID", "Name", semestercourses.CourseID);
     return View(semestercourses);
 }