// // GET: /Abonents/Delete/5 public ActionResult Delete(int id) { if (!AccessActions.IsAccess("Abonents::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "Нет доступа!"); return(RedirectToAction("Error", "User", route)); } AbonentModel theAbonent = new AbonentModel(); theAbonent.FindOne(id); theAbonent.Delete(); return(RedirectToAction("Index")); }
public ActionResult Delete(int id, FormCollection collection) { if (!AccessActions.IsAccess("Abonents::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "Нет доступа!"); return(RedirectToAction("Error", "User", route)); } try { // TODO: Add delete logic here AbonentModel theAbonent = new AbonentModel(); theAbonent.FindOne(id); theAbonent.Delete(); return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.Error = ex.Message; return(View()); } }