// // GET: /Organisation/Delete/5 public ActionResult Delete(int id) { var context = new DataContextContainer(); Organization organization = context.Organizations.Where(X => X.Id == id).FirstOrDefault(); context.DeleteObject(organization); context.SaveChanges(); return RedirectToAction("Index"); }
// // GET: /Organisation/Delete/5 public ActionResult Delete(int id) { var context = new DataContextContainer(); Organization organization = context.Organizations.Single(X => X.Id == id); context.DeleteObject(organization); try { context.SaveChanges(); } catch (Exception) { //report error return View(); } return RedirectToAction("Index"); }
public ActionResult Delete(Organization model) { try { var context = new DataContextContainer(); context.DeleteObject(model); context.SaveChanges(); return RedirectToAction("Index"); } catch { } return RedirectToAction("Index"); }