示例#1
0
        public ActionResult CreateRole(int? id)
        {
            RoleViewModel vm = new RoleViewModel();
            vm.SubMenuList = GetSubMenuList();

            vm.RoleModel = new SysRole();

            if (id.HasValue)
            {
                vm.RoleModel = _uow.SysRoleService.Get(t => t.Id == id.Value);
            }
            
            return View(vm);
        }
示例#2
0
        public ActionResult Role(string roleName,int? pageIndex)
        {
            RoleViewModel vm = new RoleViewModel();
            if (pageIndex.HasValue)
                vm.PageIndex = pageIndex.Value;
            var list = _uow.SysRoleService.GetQueryList();
            if (!string.IsNullOrEmpty(roleName))
            {
                list = list.Where(t => t.RoleName.Contains(roleName));                
            }
            vm.RoleList = new Common.Helper.PageList<SysRole>(list.OrderBy(t => t.Id), vm.PageIndex, vm.PageCount);
            vm.SubMenuList = GetSubMenuList();

            return View(vm);
        }
示例#3
0
 public ActionResult CreateRole(RoleViewModel model)
 {
     if (ModelState.IsValid)
     {
         if (model.RoleModel.Id == 0)
             _uow.SysRoleService.Add(model.RoleModel);
         else
         {
             var old = _uow.SysRoleService.Get(t => t.Id == model.RoleModel.Id);
             if (old != null)
                 old.RoleName = model.RoleModel.RoleName;
         }
         _uow.Commit();
     }
     return RedirectToAction("Role");
 }
示例#4
0
 public ActionResult SetAction(int id)
 {
     var vm = new RoleViewModel();
     vm.RoleModel = _uow.SysRoleService.Get(t => t.Id == id);
     var allActions = _uow.ActionsService.GetList().ToList();
     var tree = BuildActionTree(allActions, null);
     vm.ActionTree = tree;
     return View(vm);
 }