public async Task <ICollection <FullPlayerDTO> > GetAllPlayersDTO() { var _players = await _playersRepository.GetPlayersAsync(); return(await Task.FromResult( _players.Select(p => new FullPlayerDTO(p.Id, p.Name, p.Nick, p.City)) .ToList())); }
public async Task <SetupGameViewModel> GetAvailablePlayers(ClaimsPrincipal user) { string userName = user.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value; var players = await _playerRepo.GetPlayersAsync(); return(new SetupGameViewModel { Players = players .Select(p => Mapper.CreateFullPlayerDTO(p)) .ToList() }); }