public ActionResult Create(TimeCard timecard) { if (ModelState.IsValid) { db.TimeCards.Add(timecard); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.TimeSheetId = new SelectList(db.TimeSheets, "Id", "Id", timecard.TimeSheetId); return View(timecard); }
public ActionResult Edit(TimeCard timecard) { if (ModelState.IsValid) { db.Entry(timecard).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.TimeSheetId = new SelectList(db.TimeSheets, "Id", "Id", timecard.TimeSheetId); return View(timecard); }