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