public ActionResult Index() { using (DomainRepository domain_repository = new DomainRepository()) { ViewBag.items = domain_repository.All(); } return(View()); }
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()); }