/// <summary>
        /// Initializes a new instance of the <see cref="SimpleTeamProfileDTO"/> class
        /// </summary>
        /// <param name="record">A <see cref="simpleTeamProfileEndpoint"/> containing information about the profile</param>
        public SimpleTeamProfileDTO(simpleTeamProfileEndpoint record)
        {
            Guard.Argument(record, nameof(record)).NotNull();
            Guard.Argument(record.competitor, nameof(record.competitor)).NotNull();

            Competitor = new CompetitorDTO(record.competitor);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CompetitorProfileDTO"/> class
        /// </summary>
        /// <param name="record">A <see cref="competitorProfileEndpoint"/> containing information about the profile</param>
        public CompetitorProfileDTO(competitorProfileEndpoint record)
        {
            Guard.Argument(record, nameof(record)).NotNull();
            Guard.Argument(record.competitor, nameof(record.competitor)).NotNull();

            Competitor = new CompetitorDTO(record.competitor);
            if (record.players != null && record.players.Any())
            {
                Players = new ReadOnlyCollection <PlayerProfileDTO>(record.players.Select(p => new PlayerProfileDTO(p, record.generated_atSpecified ? record.generated_at : (DateTime?)null)).ToList());
            }
            if (record.jerseys != null)
            {
                Jerseys = new ReadOnlyCollection <JerseyDTO>(record.jerseys.Select(p => new JerseyDTO(p)).ToList());
            }
            if (record.manager != null)
            {
                Manager = new ManagerDTO(record.manager);
            }
            if (record.venue != null)
            {
                Venue = new VenueDTO(record.venue);
            }
            if (record.race_driver_profile != null)
            {
                RaceDriverProfile = new RaceDriverProfileDTO(record.race_driver_profile);
            }
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="SimpleTeamProfileDTO" /> class
        /// </summary>
        /// <param name="record">A <see cref="simpleTeamProfileEndpoint" /> containing information about the profile</param>
        public SimpleTeamProfileDTO(simpleTeamProfileEndpoint record)
        {
            Contract.Requires(record != null);
            Contract.Requires(record.competitor != null);

            Competitor = new CompetitorDTO(record.competitor);
        }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CompetitorProfileDTO"/> class
        /// </summary>
        /// <param name="record">A <see cref="competitorProfileEndpoint"/> containing information about the profile</param>
        public CompetitorProfileDTO(competitorProfileEndpoint record)
        {
            Contract.Requires(record != null);
            Contract.Requires(record.competitor != null);

            Competitor = new CompetitorDTO(record.competitor);
            if (record.players != null && record.players.Any())
            {
                Players = new ReadOnlyCollection <PlayerProfileDTO>(record.players.Select(p => new PlayerProfileDTO(p)).ToList());
            }
            if (record.jerseys != null)
            {
                Jerseys = new ReadOnlyCollection <JerseyDTO>(record.jerseys.Select(p => new JerseyDTO(p)).ToList());
            }
            if (record.manager != null)
            {
                Manager = new ManagerDTO(record.manager);
            }
            if (record.venue != null)
            {
                Venue = new VenueDTO(record.venue);
            }
        }