public ActionResult Create(Course course) { if (ModelState.IsValid) { db.Courses.Add(course); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.BachelorProgrammeId = new SelectList(db.BachelorProgrammes, "BachelorProgrammeId", "Name", course.BachelorProgrammeId); return View(course); }
public ActionResult Edit(Course course) { if (ModelState.IsValid) { db.Entry(course).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.BachelorProgrammeId = new SelectList(db.BachelorProgrammes, "BachelorProgrammeId", "Name", course.BachelorProgrammeId); return View(course); }