Beispiel #1
0
        public PlayerViewModel BuildViewModel(int?id = null)
        {
            var gameSelectListItems = GetGameSelectListItems();
            var player     = _playerRepository.GetBy(id ?? 0);
            var gamesOwned = GetGamesOwned(id);

            return(_playerMapper.Map(player, gameSelectListItems, gamesOwned));
        }
Beispiel #2
0
        public IEnumerable <IPlayer> All()
        {
            var playerData = _dataProvider.Get()
                             .Select(d => _mapper.Map(d))
                             .ToArray();

            return(playerData);
        }
Beispiel #3
0
        public IEnumerable <Player> GetPlayerId(string name)
        {
            if (name == null)
            {
                return(new List <Player>());
            }

            var data  = _database.People;
            var names = name.Split(null);

            return(MatchAllNames(data, names)
                   .ToList()
                   .Select <People, Player>(s =>
            {
                return _mapper.Map(s);
            }));
        }
Beispiel #4
0
        public PlayersViewModel BuildViewModel()
        {
            var players = _playerRepository.GetAll()
                          .Select(player => _mapper.Map(player));

            return(new PlayersViewModel
            {
                Players = players
            });
        }
        public void RegisterTeam(TeamWithPlayers teamWithPlayers)
        {
            var ratings = _ratingService.Get().ToList();

            var team   = _teamMapper.Map(teamWithPlayers, ratings);
            var teamId = _teamService.Insert(team).Id;

            var players = _playerMapper.Map(teamWithPlayers.Players, ratings, teamId);

            _playerService.InsertMany(players);
        }