Exemple #1
0
        private async Task SetRoleList()
        {
            //获取所有角色
            var sysRoleService = new SysRoleService();

            ViewBag.SysRoleList = await sysRoleService.GetAllSysRole();
        }
Exemple #2
0
        public async Task <ActionResult> SysRoleList(int pageIndex = 1, int pageSize = 20)
        {
            //总页码、当前页码、可显示总页码
            var sysRoleSvc = new SysRoleService();
            //当前第n页数据
            var sysRole = await sysRoleSvc.GetAllSysRole(pageIndex, pageSize, false);

            //总个数
            var dataCount = await sysRoleSvc.GetDataCount();

            //绑定分页
            var list = new PagedList <SysRoleDto>(sysRole, pageIndex, pageSize, dataCount);

            return(View(list));
        }
Exemple #3
0
        public async Task <ActionResult> SysUserEdit(Guid id)
        {
            //获取用户信息
            var sysUserService = new SysUserService();
            var data           = await sysUserService.GetOneSysUserById(id);

            List <Guid> roleIds = new List <Guid>();

            foreach (var t in data.SysUserRoles.Where(a => !a.IsRemoved))
            {
                roleIds.Add(t.SysRoleId);
            }

            //权限集合
            List <SelectListItem> selectList = new List <SelectListItem>();
            var list = await new SysDepartService().GetAllSysDepart();

            foreach (var item in list)
            {
                selectList.Add(data.SysDepartId == item.Id
                    ? new SelectListItem {
                    Text = item.DepartName, Value = item.Id.ToString(), Selected = true
                }
                    : new SelectListItem {
                    Text = item.DepartName, Value = item.Id.ToString()
                });
            }
            ViewBag.SysDepartList = selectList;

            //获取所有角色
            var sysRoleService = new SysRoleService();

            ViewBag.SysRoleList = await sysRoleService.GetAllSysRole();

            return(View(new SysUserViewModel()
            {
                Id = data.Id,
                RealName = data.RealName,
                UserName = data.UserName,
                SysRoleIds = roleIds.ToArray(),
                CreateTime = data.CreateTime.ToString("yyyy-dd-MM")
            }));
        }
Exemple #4
0
        public async Task <ActionResult> Register()
        {
            List <SelectListItem> selectList = new List <SelectListItem>();
            var list = await new SysDepartService().GetAllSysDepart();

            foreach (var item in list)
            {
                selectList.Add(new SelectListItem {
                    Text = item.DepartName, Value = item.Id.ToString()
                });
            }
            ViewBag.SysDepartList = selectList;

            //获取所有角色
            var sysRoleService = new SysRoleService();

            ViewBag.SysRoleList = await sysRoleService.GetAllSysRole();

            return(View());
        }