示例#1
0
        public static PlayerResultFixtureDto AssembleDto(this PlayerFixture fixture)
        {
            var dto = new PlayerResultFixtureDto
            {
                ID       = fixture.ID,
                Entrant1 = fixture.Entrant1.AssembleDto(),
                Entrant2 = fixture.Entrant2.AssembleDto(),
                Legs     = fixture.Legs,
                FixtureCalculationEngineID = fixture.FixtureCalculationEngineID,
                FixtureStatusID            = fixture.FixtureStatusID,
                Result1     = fixture.AssembleFixtureEntrant1Score(),
                Result2     = fixture.AssembleFixtureEntrant2Score(),
                SummaryData = fixture.AssembleSummaryDataDto()
            };

            foreach (var match in fixture.Matches)
            {
                var homeEntrant = (match.Home.ID == fixture.Entrant1.ID ? dto.Entrant1 : dto.Entrant2);
                var awayEntrant = (match.Away.ID == fixture.Entrant2.ID ? dto.Entrant2 : dto.Entrant1);

                var matchDto = match.AssembleDto(homeEntrant, awayEntrant);
                dto.Matches.Add(matchDto);
            }

            return(dto);
        }
示例#2
0
        private static ConfirmedPlayerFixtureDto AssembleConfirmedDto(PlayerFixture fixture)
        {
            var dto = new ConfirmedPlayerFixtureDto();

            PopulateBaseValues(dto, fixture);

            dto.Entrant1 = fixture.Entrant1.AssembleDto();
            dto.Entrant2 = fixture.Entrant2.AssembleDto();
            dto.Result1  = fixture.AssembleFixtureEntrant1Score();
            dto.Result2  = fixture.AssembleFixtureEntrant2Score();

            foreach (var match in fixture.Matches)
            {
                var homeEntrant = (match.Home.ID == fixture.Entrant1.ID ? dto.Entrant1 : dto.Entrant2);
                var awayEntrant = (match.Away.ID == fixture.Entrant2.ID ? dto.Entrant2 : dto.Entrant1);

                var matchDto = match.AssembleDto(homeEntrant, awayEntrant);
                dto.Matches.Add(matchDto);
            }

            return(dto);
        }