Esempio n. 1
0
        public ActionResult Create(Programcourses programcourses)
        {
            if (ModelState.IsValid)
            {
                db.Programcourses.Add(programcourses);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.ProgramID = new SelectList(db.Programs, "ProgramID", "Name", programcourses.ProgramID);
            ViewBag.CourseID = new SelectList(db.Courses, "CourseID", "Name", programcourses.CourseID);
            return View(programcourses);
        }
Esempio n. 2
0
 public ActionResult Edit(Programcourses programcourses)
 {
     if (ModelState.IsValid)
     {
         db.Entry(programcourses).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.ProgramID = new SelectList(db.Programs, "ProgramID", "Name", programcourses.ProgramID);
     ViewBag.CourseID = new SelectList(db.Courses, "CourseID", "Name", programcourses.CourseID);
     return View(programcourses);
 }