Beispiel #1
0
        public List <Score> InsertOrderedScores(ScoreModel[] scoreBoard, List <Player> players, int matchId)
        {
            var idx = 1;
            var scoresWithPosition = scoreBoard.Select(model =>
                                                       new Score()
            {
                Player   = players[idx - 1],
                Deaths   = model.Deaths.Value,
                Frags    = model.Frags.Value,
                Kills    = model.Kills.Value,
                Position = idx++,
                MatchId  = matchId,
            }
                                                       ).ToList();

            _scoreRepository.Insert(scoresWithPosition);
            return(scoresWithPosition);
        }