public ActionResult Delete(int id, otherLocation location) { try { using (var db = new SDES_DirectoryEntities()) { var specific = db.otherLocations.Find(id); db.Entry(specific).State = EntityState.Deleted; db.SaveChanges(); } return RedirectToAction("Index"); } catch { return View(location); } }
public ActionResult Create(otherLocation location) { try { using (var db = new SDES_DirectoryEntities()) { db.otherLocations.Add(location); db.SaveChanges(); } return RedirectToAction("Index"); } catch { ViewBag.officeId = Init.PopulateOfficesDropDownList(); return View(location); } }
public ActionResult Edit(int id, otherLocation location) { try { using (var db = new SDES_DirectoryEntities()) { db.Entry(location).State = EntityState.Modified; db.SaveChanges(); } return RedirectToAction("Index"); } catch { return View(location); } }