// // GET: /Abonents/Details/5 public ActionResult Details(int id) { if (!AccessActions.IsAccess("Abonents::Read")) { 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); return(View(theAbonent)); }
// // GET: /Abonents/Edit/5 public ActionResult Edit(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(); BrancheModel branch = new BrancheModel(); ViewBag.AllBranches = branch.FindAll(); return(View(theAbonent.FindOne(id))); }
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()); } }