/// <summary> /// Initializes a new instance of the <see cref="TournamentDTO"/> class. /// </summary> /// <param name="tournament">The <see cref="tournamentExtended"/> used for creating instance</param> internal TournamentDTO(tournamentExtended tournament) : base(tournament.id, tournament.name) { Contract.Requires(tournament != null); Scheduled = tournament.scheduledSpecified ? (DateTime?)tournament.scheduled : null; ScheduledEnd = tournament.scheduled_endSpecified ? (DateTime?)tournament.scheduled_end : null; Sport = new SportEntityDTO(tournament.sport.id, tournament.sport.name); Category = tournament.category == null && tournament.id.StartsWith("vf") ? CreateFakeCategory() : new CategorySummaryDTO(tournament.category?.id, tournament.category?.name, tournament.category?.country_code); CurrentSeason = tournament.current_season == null ? null : new SeasonDTO(tournament.current_season); SeasonCoverage = tournament.season_coverage_info == null ? null : new SeasonCoverageDTO(tournament.season_coverage_info); }
/// <summary> /// Initializes a new instance of the <see cref="TournamentDTO"/> class. /// </summary> /// <param name="tournament">The <see cref="tournament"/> used for creating instance</param> internal TournamentDTO(tournament tournament) : base(tournament.id, tournament.name) { Contract.Requires(tournament != null); Scheduled = tournament.scheduledSpecified ? (DateTime?)tournament.scheduled : null; ScheduledEnd = tournament.scheduled_endSpecified ? (DateTime?)tournament.scheduled_end : null; Sport = new SportEntityDTO(tournament.sport.id, tournament.sport.name); //TODO: check for 'vf': is it still required? Category = tournament.category == null && tournament.id.StartsWith("vf") ? CreateFakeCategory() : new CategorySummaryDTO(tournament.category?.id, tournament.category?.name, tournament.category?.country_code); CurrentSeason = null; SeasonCoverage = null; }