public MatchModel GetMatchModelForNextRound( PlayerModel player, IEnumerable<PlayerModel> playersToProcess, IList<MatchModel> previousMatches) { var match = new MatchModel { Player1 = player, Player2 = new PlayerModel { PlayerId = SpecialPlayerIds.WinnerIdForGameWithUndefinedResult } }; match.Player2 = playersToProcess.FirstOrDefault(p => _playerHelper.PlayersCanPlayTogether(player, p, previousMatches)); return match; }
public void Add(MatchModel matchModel) { var match = Mapper.Map<Match>(matchModel); _unitOfWork.MatchRepository.Add(match); }