internal DrawDTO(draw_fixtures item)
            : base(new sportEvent
        {
            id   = item == null ? "wns:draw:1" : item.draw_fixture?.id,
            name = string.Empty,
            scheduledSpecified = item?.draw_fixture?.draw_dateSpecified ?? false,
            scheduled          = item?.draw_fixture?.draw_date ?? DateTime.MinValue,
            tournament         = item?.draw_fixture?.lottery == null
                    ? null
                    : new tournament
            {
                sport = item.draw_fixture?.lottery.sport
            }
        })
        {
            if (item == null || item.draw_fixture == null)
            {
                return;
            }

            var fixture = item.draw_fixture;

            if (fixture.lottery != null)
            {
                Lottery = new LotteryDTO(fixture.lottery);
            }
            Status = RestMapperHelper.MapDrawStatus(fixture.status, fixture.statusSpecified);

            DisplayId = fixture.display_idSpecified
                            ? fixture.display_id
                            : (int?)null;

            GeneratedAt = item.generated_atSpecified ? item.generated_at : (DateTime?)null;
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DrawFixtureMapper"/> class
        /// </summary>
        /// <param name="drawFixture">A <see cref="draw_fixtures"/> containing lottery draw data</param>
        internal DrawFixtureMapper(draw_fixtures drawFixture)
        {
            Contract.Requires(drawFixture != null);

            _drawFixture = drawFixture;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DrawFixtureMapper"/> class
        /// </summary>
        /// <param name="drawFixture">A <see cref="draw_fixtures"/> containing lottery draw data</param>
        internal DrawFixtureMapper(draw_fixtures drawFixture)
        {
            Guard.Argument(drawFixture, nameof(drawFixture)).NotNull();

            _drawFixture = drawFixture;
        }