public ActionResult Create(TimeTableEntry timetableentry) { if (ModelState.IsValid) { db.TimeTableEntries.Add(timetableentry); db.Commit(); return RedirectToAction("Index"); } return View(timetableentry); }
public ActionResult Edit(TimeTableEntry timetableentry) { if (ModelState.IsValid) { //db.Entry(timetableentry).State = EntityState.Modified; db.TimeTableEntries.GetById(timetableentry.Id).EndTime = timetableentry.EndTime; db.TimeTableEntries.GetById(timetableentry.Id).Description = timetableentry.Description; db.TimeTableEntries.GetById(timetableentry.Id).Location = timetableentry.Location; db.TimeTableEntries.GetById(timetableentry.Id).StartTime = timetableentry.StartTime; db.TimeTableEntries.GetById(timetableentry.Id).TimeTable = timetableentry.TimeTable; db.TimeTableEntries.GetById(timetableentry.Id).TimeTableId = timetableentry.TimeTableId; db.TimeTableEntries.GetById(timetableentry.Id).Title = timetableentry.Title; db.Commit(); return RedirectToAction("Index"); } //ViewBag.TimeTableId = new SelectList(db.TimeTables, "Id", "Id", timetableentry.TimeTableId); return View(timetableentry); }