public ActionResult Edit([Bind(Include = "CourseID,Name,ScheduleBegin,ScheduleEnd,CalendarBegin,CalendarEnd,Description,FieldID")] Course course) { if (ModelState.IsValid) { db.Entry(course).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.FieldID = new SelectList(ComboField.GetFields(), "FieldID", "Description", course.FieldID); return(View(course)); }
// GET: Courses/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Course course = db.Courses.Find(id); if (course == null) { return(HttpNotFound()); } ViewBag.FieldID = new SelectList(ComboField.GetFields(), "FieldID", "Description", course.FieldID); return(View(course)); }
// GET: Courses/Create public ActionResult Create() { ViewBag.FieldID = new SelectList(ComboField.GetFields(), "FieldID", "Description"); return(View()); }