public ActionResult Create() { ViewBag.ClassRosterId = new SelectList(db.ClassRosters, "ClassRosterId", "ClassRosterId"); var rosterAttendance = new RosterAttendance { ClassDate = DateTime.Now }; return View(rosterAttendance); }
public ActionResult Create(RosterAttendance rosterattendance) { if (ModelState.IsValid) { db.RosterAttendances.Add(rosterattendance); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.ClassRosterId = new SelectList(db.ClassRosters, "ClassRosterId", "ClassRosterId", rosterattendance.ClassRosterId); return View(rosterattendance); }
public ActionResult Edit(RosterAttendance rosterattendance) { if (ModelState.IsValid) { db.Entry(rosterattendance).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.ClassRosterId = new SelectList(db.ClassRosters, "ClassRosterId", "ClassRosterId", rosterattendance.ClassRosterId); return View(rosterattendance); }