/// <summary> /// Initializes a new instance of the <see cref="StageDTO"/> class /// </summary> /// <param name="stageEvent">A <see cref="stageSummaryEndpoint"/> containing basic information about the event</param> internal StageDTO(stageSummaryEndpoint stageEvent) : base(stageEvent) { if (stageEvent.sport_event == null) { return; } if (stageEvent.sport_event.races != null && stageEvent.sport_event.races.Any()) { Stages = stageEvent.sport_event.races.Select(s => new StageDTO(s)); } if (stageEvent.sport_event?.tournament != null) { Tournament = new TournamentDTO(stageEvent.sport_event.tournament); } if (stageEvent.sport_event.parent != null) { ParentStage = new StageDTO(stageEvent.sport_event.parent); } if (ParentStage == null && Type != null && Type == SportEventType.Parent && stageEvent.sport_event.tournament != null) { ParentStage = new StageDTO(new TournamentDTO(stageEvent.sport_event.tournament)); } if (!stageEvent.sport_event.additional_parents.IsNullOrEmpty()) { AdditionalParents = stageEvent.sport_event.additional_parents.Select(s => new StageDTO(s)); } }
/// <summary> /// Initializes a new instance of the <see cref="CompetitionDTO"/> class /// </summary> /// <param name="stageSummary">A <see cref="stageSummaryEndpoint"/> instance containing basic information about the sport event</param> internal CompetitionDTO(stageSummaryEndpoint stageSummary) : this(stageSummary.sport_event) { Contract.Requires(stageSummary != null); Status = stageSummary.sport_event_status == null ? null : new SportEventStatusDTO(stageSummary.sport_event_status); }
/// <summary> /// Initializes a new instance of the <see cref="CompetitionDTO"/> class /// </summary> /// <param name="stageSummary">A <see cref="stageSummaryEndpoint"/> instance containing basic information about the sport event</param> internal CompetitionDTO(stageSummaryEndpoint stageSummary) : this(stageSummary.sport_event) { Guard.Argument(stageSummary, nameof(stageSummary)).NotNull(); SportEventStatus = stageSummary.sport_event_status == null ? null : new SportEventStatusDTO(stageSummary.sport_event_status); GeneratedAt = stageSummary.generated_atSpecified ? stageSummary.generated_at.ToLocalTime() : (DateTime?)null; }
/// <summary> /// Initializes a new instance of the <see cref="StageDTO"/> class /// </summary> /// <param name="stageEvent">A <see cref="stageSummaryEndpoint"/> containing basic information about the event</param> internal StageDTO(stageSummaryEndpoint stageEvent) : base(stageEvent) { if (stageEvent.sport_event.parent != null) { ParentStage = new StageDTO(stageEvent.sport_event.parent); } if (stageEvent.sport_event.races != null && stageEvent.sport_event.races.Any()) { Stages = stageEvent.sport_event.races.Select(s => new StageDTO(s)); } if (stageEvent.sport_event?.tournament != null) { Tournament = new TournamentDTO(stageEvent.sport_event.tournament); } }
/// <summary> /// Initializes a new instance of the <see cref="StageDTO" /> class /// </summary> /// <param name="stageEvent">A <see cref="stageSummaryEndpoint" /> containing basic information about the event</param> internal StageDTO(stageSummaryEndpoint stageEvent) : base(stageEvent) { if (stageEvent.sport_event.parent != null) { ParentStage = new StageDTO(stageEvent.sport_event.parent); } if (stageEvent.sport_event.races != null && stageEvent.sport_event.races.Any()) { Stages = stageEvent.sport_event.races.Select(s => new StageDTO(s)); } if (stageEvent.sport_event?.tournament != null) { Contract.Assume(!string.IsNullOrEmpty(stageEvent.sport_event.tournament.id)); Contract.Assume(!string.IsNullOrEmpty(stageEvent.sport_event.tournament.name)); Tournament = new TournamentDTO(stageEvent.sport_event.tournament); } }
/// <summary> /// Initializes a new instance of the <see cref="SportEventSummaryMapper"/> class. /// </summary> /// <param name="stageSummaryData">A <see cref="stageSummaryEndpoint"/> containing stage data</param> internal SportEventSummaryMapper(stageSummaryEndpoint stageSummaryData) { Guard.Argument(stageSummaryData, nameof(stageSummaryData)).NotNull(); _stageSummaryData = stageSummaryData; }
/// <summary> /// Initializes a new instance of the <see cref="SportEventSummaryMapper"/> class. /// </summary> /// <param name="stageSummaryData">A <see cref="stageSummaryEndpoint"/> containing stage data</param> internal SportEventSummaryMapper(stageSummaryEndpoint stageSummaryData) { Contract.Requires(stageSummaryData != null); _stageSummaryData = stageSummaryData; }