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 )); }
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 }); }