public async Task <GetManagerListDto> GetManagerByIdAsync(NullableIdDto <long> input) { GetManagerListDto entity; //获取用户当前权限下面的角色列表数据 var roleList = await _roleManage.GetRoleAllAsync(); if (input.Id.HasValue) { var query = await _managerManage.GetManagerByIdAsync(input.Id.Value, new List <string> { "UserBase.Roles" }); if (query == null) { throw new UserFriendlyException($"操作失败,标识符[{input.Id}不存在或已被管理员删除]"); } entity = query.MapTo <GetManagerListDto>(); entity.RoleList = roleList.MapTo <List <GetAllIncludeUserRole> >(); entity.RoleList.ForEach(x => { x.IsChecked = entity.UserBase.Roles.Any(y => y.Id == x.Id); }); } else { entity = new GetManagerListDto { RoleList = roleList.MapTo <List <GetAllIncludeUserRole> >() }; } return(entity); }
public async Task <List <RoleListDto> > GetRoleListAsync() { var roleListDto = await _roleManage.GetRoleAllAsync(); return(roleListDto.MapTo <List <RoleListDto> >()); }