public ActionResult DeleteMaterial(int ID) { bool res; using (DBAgent.DBAgent agent = new DBAgent.DBAgent()) { res = agent.DeleteMaterial(ID); } if (res) { return(Redirect("/Home/Index")); } else { return(View("~/Views/Shared/Error.cshtml")); } }