コード例 #1
0
ファイル: SysRoleService.cs プロジェクト: bradypodest/K.CoreT
        public override async Task <MessageModel <bool> > DeleteOne(string ID)
        {
            MessageModel <bool> messageModel = MessageModel <bool> .Fail();

            //删除前验证
            base.DelOnExecute = async(SysRole modelExecute) =>
            {
                //查询是否有该角色
                List <SysRole> sysRoles = await _dal.Query(x => x.RoleID.Equals(modelExecute.RoleID) && x.Status == 1);

                if (sysRoles != null && sysRoles.Count > 0)
                {
                }
                else
                {
                    return(MessageModel <bool> .Fail("不存在该角色"));
                }

                //查询是否有用户有该对应的角色
                List <SysUser> sysUsers = await _sysUserRepository.Query(x => x.Status == 1 && x.RoleId == modelExecute.RoleID);

                if (sysUsers != null && sysUsers.Count > 0)
                {
                    return(MessageModel <bool> .Fail("有用户是该角色"));
                }

                return(MessageModel <bool> .Success());
            };

            return(await base.DeleteOne(ID));
        }
コード例 #2
0
 public async Task <List <SysUser> > GetALLUser()
 {
     return(await sysUserRepository.Query(x => x.Id >= 1 && x.IsDelete == false && x.Role != 0));
 }
コード例 #3
0
 public List <SysUser> GetUserList()
 {
     return(_userRepository.Query().ToList());
 }