public ActionResult Delete(int id, office office) { try { using (var db = new SDES_DirectoryEntities()) { var office1 = db.offices.Find(id); db.Entry(office1).State = EntityState.Deleted; db.SaveChanges(); return RedirectToAction("Index"); } } catch { return View(office); } }
public ActionResult Create(office office) { try { using(var db = new SDES_DirectoryEntities()) { db.offices.Add(office); db.SaveChanges(); } return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Edit(int id, office office) { try { using (var db = new SDES_DirectoryEntities()) { db.Entry(office).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } } catch { return View(); } }