예제 #1
0
    private static FormationDetails OrderByFormation(string teamName, LineupContainer teamLineup)
    {
        var p = new List <FormationSegment>();

        foreach (var segment in teamLineup.Formation.Players)
        {
            var playersInSegment = segment.Select(playerId => teamLineup.Lineup.First(p => p.Id == playerId));
            p.Add(new FormationSegment
                  (
                      playersInSegment.First().MatchPosition,
                      playersInSegment.Select(i => new SegmentPlayer
                                              (
                                                  i.Name.ToString(),
                                                  i.Captain
                                              )).ToList()
                  ));
        }

        return(new FormationDetails
               (
                   teamName,
                   teamLineup.Formation.Label,
                   p
               ));
    }
예제 #2
0
        private static FormationDetails OrderByFormation(LineupContainer teamLineup)
        {
            var p = new List <FormationSegment>();

            foreach (var segment in teamLineup.Formation.Players)
            {
                var playersInSegment = segment.Select(playerId => teamLineup.Lineup.First(p => p.Id == playerId));
                p.Add(new FormationSegment
                {
                    SegmentPosition  = playersInSegment.First().MatchPosition,
                    PlayersInSegment = playersInSegment
                });
            }

            return(new FormationDetails
            {
                Label = teamLineup.Formation.Label,
                Segments = p
            });
        }