Ejemplo n.º 1
0
        public virtual async Task <PagedResultDto <ClubPlayerListDto> > GetPlayersListAsync(Guid id, GetClubPlayersInput input)
        {
            long totalCount = await _clubPlayerRepository.GetCountAsync(
                input.FilterText,
                id,
                null,
                input.IsPrimaryClubOfPlayer);

            IQueryable <ClubPlayer> clubPlayerQueryable = await _clubPlayerRepository.GetFilteredQueryableAsync(
                input.FilterText,
                id,
                null,
                input.IsPrimaryClubOfPlayer,
                input.Sorting,
                input.MaxResultCount);

            IQueryable <Player> playerQueryable = await _playerRepository.GetFilteredQueryableAsync(input.FilterText);

            IQueryable <ClubPlayerWithNavigationProperties> clubPlayerWithNavigationPropertiesQueryable = clubPlayerQueryable.Join(
                playerQueryable,
                x => x.PlayerId,
                x => x.Id,
                (clubPlayer, player) => new ClubPlayerWithNavigationProperties()
            {
                Id       = clubPlayer.Id,
                ClubId   = clubPlayer.ClubId,
                PlayerId = clubPlayer.PlayerId,
                Player   = player,
                IsPrimaryClubOfPlayer = clubPlayer.IsPrimaryClubOfPlayer
            });

            IQueryable <ClubPlayerListDto> clubPlayerListDtoQueryable = ObjectMapper
                                                                        .GetMapper()
                                                                        .ProjectTo <ClubPlayerListDto>(clubPlayerWithNavigationPropertiesQueryable);

            return(new PagedResultDto <ClubPlayerListDto>()
            {
                TotalCount = totalCount,
                Items = await AsyncExecuter.ToListAsync(clubPlayerListDtoQueryable)
            });
        }
Ejemplo n.º 2
0
 public virtual Task <PagedResultDto <ClubPlayerListDto> > GetClubsListAsync(Guid id, GetClubPlayersInput input)
 {
     return(_playersAppService.GetClubsListAsync(id, input));
 }