Esempio n. 1
0
        public ActionResult Edit(long?var_id)
        {
            using (VariableRepository variable_repository = new VariableRepository())
            {
                ViewBag.groups = variable_repository.AllGroups(CurrentUser.user_domain);

                if (var_id.HasValue)
                {
                    ViewBag.item = variable_repository.GetByID(var_id.Value);
                }
            }

            return(View());
        }
Esempio n. 2
0
        public ActionResult Edit(long?user_id, long?user_domain)
        {
            using (UserRepository user_repository = new UserRepository())
            {
                ViewBag.user_roles = user_repository.AllUserRoles();

                if (user_id.HasValue)
                {
                    ViewBag.item = user_repository.GetByID(user_id.Value);
                }
            }

            using (DomainRepository domain_repository = new DomainRepository())
            {
                ViewBag.domains = domain_repository.All();
            }

            if (user_id.HasValue && !user_domain.HasValue)
            {
                ViewBag.current_domain_id = ViewBag.item.user_domain;
            }
            else if (user_domain.HasValue)
            {
                ViewBag.current_domain_id = user_domain;
            }
            else
            {
                ViewBag.current_domain_id = ViewBag.domains[0].domain_id;
            }

            using (BlockRepository block_repository = new BlockRepository())
            {
                ViewBag.blocks = block_repository.All(user_domain ?? ViewBag.current_domain_id);
            }

            using (VariableRepository variable_repository = new VariableRepository())
            {
                ViewBag.var_groups = variable_repository.AllGroups(user_domain ?? ViewBag.current_domain_id);
            }



            return(View());
        }