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); }
private static void PopulateBaseValues(BasePlayerFixtureDto dto, PlayerFixture data) { dto.ID = data.ID; dto.Legs = data.Legs; dto.FixtureCalculationEngineID = data.FixtureCalculationEngineID; dto.FixtureStatusID = data.FixtureStatusID; dto.SummaryData = data.AssembleSummaryDataDto(); dto.Reference = data.Reference; }