コード例 #1
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)
        {
            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);
            }
        }
コード例 #2
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);
            }
        }