コード例 #1
0
        public static PlayerMatchDto AssembleDto(this PlayerMatch match, PlayerEntrantDto homeEntrant, PlayerEntrantDto awayEntrant)
        {
            var dto = new PlayerMatchDto
            {
                ID                       = match.ID,
                FixtureID                = match.PlayerFixture.ID,
                CompetitionID            = match.PlayerFixture.CompetitionID,
                CompetitionStageSequence = match.PlayerFixture.CompetitionRound.CompetitionEvent.CompetitionStage.Sequence,
                Leg                      = match.Leg,
                Date                     = match.Date,
                MatchStatusID            = match.MatchStatusID,
                MatchCalculationEngineID = match.MatchCalculationEngineID,
                Pitch                    = match.Pitch.AssembleDto(),
                HomeEntrant              = homeEntrant,
                AwayEntrant              = awayEntrant,
                VenueTypeID              = match.VenueTypeID,
                Comment                  = match.Comment
            };

            if (match.MatchStatusID.IsProcessedWithResult())
            {
                dto.HomeResult = match.AssembleMatchHomeScore();
                dto.AwayResult = match.AssembleMatchAwayScore();

                foreach (PlayerMatchXGame playerMatchGame in match.Games)
                {
                    var gameDto = playerMatchGame.Game.AssembleDto();
                    dto.Games.Add(gameDto);
                }
            }

            return(dto);
        }
コード例 #2
0
        public static PlayerEntrantDto AssembleDto(this CompetitionEntrant entrant)
        {
            var dto = new PlayerEntrantDto();

            dto.Players.AddRange(entrant.Players.Select(x => PlayerDtoAssembler.AssembleDto(x.Player)));
            return(dto);
        }