예제 #1
0
        public async Task <List <ProjectMember> > GetProjectMembers(int projectId, int roleId = 0, CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.ThrowIfCancellationRequested();

            var projectMemberByProjectSpec = new ProjectMemberFilterSpecification(projectId, 0, roleId: roleId);
            var projectMembers             = await _projectMemberRepository.GetBySpec(projectMemberByProjectSpec, cancellationToken);

            return(projectMembers.ToList());
        }
예제 #2
0
        public async Task <List <ProjectMember> > GetProjectMembers(int projectId, int roleId = 0, bool includeUser = false, CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.ThrowIfCancellationRequested();

            var projectMemberByProjectSpec = new ProjectMemberFilterSpecification(projectId, 0, roleId: roleId);

            var projectMembers = (await _projectMemberRepository.GetBySpec(projectMemberByProjectSpec, cancellationToken)).ToList();

            if (includeUser)
            {
                var users = await _userService.GetUsersByIds(projectMembers.Select(p => p.UserId).ToArray());

                foreach (var projectMember in projectMembers)
                {
                    projectMember.User = users.FirstOrDefault(u => u.Id == projectMember.UserId);
                }
            }

            return(projectMembers);
        }