示例#1
0
        //
        // 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));
        }
示例#2
0
        //
        // 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)));
        }
示例#3
0
 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());
     }
 }