public ActionResult Delete(int id, Timesheet sheet) { try { using (var db = new Timesheet1()) { db.Entry(sheet ).State = System.Data.Entity. EntityState.Deleted; db.SaveChanges(); } return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult add(Timesheet sheet) { try { using (var db = new Timesheet1()) { db.entry.Add(sheet); db.SaveChanges(); } return RedirectToAction("Index"); } catch { return View(); } }