public ActionResult Create(CourseQuestion coursequestion) { if (ModelState.IsValid) { db.CourseQuestions.Add(coursequestion); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.ClassID = new SelectList(db.Courses, "ClassID", "ClassName", coursequestion.ClassID); return View(coursequestion); }
public ActionResult Edit(CourseQuestion coursequestion) { if (ModelState.IsValid) { db.Entry(coursequestion).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.ClassID = new SelectList(db.Courses, "ClassID", "ClassName", coursequestion.ClassID); return View(coursequestion); }