public ActionResult DeleteAll(string id) { try { rep.DeleteAll(); rep.Save(); return(RedirectToAction("Index")); } catch (Exception e) { if (this.HttpContext.IsDebuggingEnabled) { ModelState.AddModelError(string.Empty, e.ToString()); } else { ModelState.AddModelError(string.Empty, "some technical error happened"); } return(View()); } }