Exemplo n.º 1
0
        //
        // GET: /User/Edit/5

        public ActionResult Edit(int id)
        {
            if (!AccessActions.IsAccess("User::Write"))
            {
                System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary();
                route.Add("err", "��� �������!");
                return(RedirectToAction("Error", "User", route));
            }
            UserModel    user   = new UserModel();
            RoleModel    role   = new RoleModel();
            BrancheModel branch = new BrancheModel();
            ActionModel  action = new ActionModel();
            TypeModel    type   = new TypeModel();

            //заполнение списка ролей
            ViewBag.Roles = role.FindAll();
            //Заполнение списка филиалов
            ViewBag.AllBranches  = branch.FindAll();
            ViewBag.UserBranches = branch.UserBranches(id);
            ViewBag.UserActions  = action.UserActions(id);
            ViewBag.AllActions   = action.FindAll();
            ViewBag.UserTypes    = type.UserTypes(id);
            ViewBag.AllTypes     = type.FindAll();
            user.FindByID(id);
            ViewBag.UsName = user.Name;
            return(View(user));
        }
Exemplo n.º 2
0
        //
        // GET: /Branches/Edit/5

        public ActionResult Edit(int id)
        {
            if (!AccessActions.IsAccess("Branches::Write"))
            {
                System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary();
                route.Add("err", "Нет доступа!");
                return(RedirectToAction("Error", "User", route));
            }
            BrancheModel model = new BrancheModel();

            model.FindOne(id);
            return(View(model));
        }
Exemplo n.º 3
0
        public HttpResponseMessage Get(string BranchName)
        {
            BrancheModel SingleBranch = BrancheManager.GetSpesificBranche(BranchName);

            if (SingleBranch == null)
            {
                return(new HttpResponseMessage(HttpStatusCode.BadRequest));
            }
            return(new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new ObjectContent <BrancheModel>(SingleBranch, new JsonMediaTypeFormatter())
            });
        }
Exemplo n.º 4
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)));
        }
Exemplo n.º 5
0
        // GET: /User/Create

        public ActionResult Create()
        {
            if (!AccessActions.IsAccess("User::Write"))
            {
                System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary();
                route.Add("err", "��� �������!");
                return(RedirectToAction("Error", "User", route));
            }
            RoleModel    role   = new RoleModel();
            BrancheModel branch = new BrancheModel();

            //заполнение списка ролей
            ViewBag.Roles = role.FindAll();
            //Заполнение списка филиалов
            ViewBag.Branches = branch.FindAll();
            return(View());
        }
Exemplo n.º 6
0
        //
        // GET: /Groups/Edit/5

        public PartialViewResult EditIndex(int GroupID)
        {
            if (!AccessActions.IsAccess("Groups::Write"))
            {
                System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary();
                ViewBag.Error = "Нет доступа!";
                return(PartialView("_Error"));
            }

            GroupModel Group = new GroupModel();

            Group = Group.FindOne(GroupID);

            ViewBag.GroupAbonents = Group.Abonents();
            ViewBag.AllAbonents   = Group.AbonentsAll();
            BrancheModel branch = new BrancheModel();

            ViewBag.AllBranches = branch.FindAll();
            return(PartialView("_AbonentsGroupEdit", Group));
        }
Exemplo n.º 7
0
 public ActionResult Create(FormCollection collection)
 {
     if (!AccessActions.IsAccess("Branches::Write"))
     {
         System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary();
         route.Add("err", "Нет доступа!");
         return(RedirectToAction("Error", "User", route));
     }
     try
     {
         // TODO: Add insert logic here
         BrancheModel model = new BrancheModel();
         model.name_full  = collection["name_full"];
         model.name_short = collection["name_short"];
         model.Create();
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         ViewBag.Error = ex.Message;
         return(View());
     }
 }