internal DrawDTO(draw_summary item) : base(new sportEvent { id = item.draw_fixture == 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 } }) { Guard.Argument(item, nameof(item)).NotNull(); DisplayId = null; if (item.draw_fixture != null) { if (item.draw_fixture.id != null && item.draw_fixture.lottery != null) { Lottery = new LotteryDTO(item.draw_fixture.lottery); } Status = RestMapperHelper.MapDrawStatus(item.draw_fixture.status, item.draw_fixture.statusSpecified); DisplayId = item.draw_fixture.display_idSpecified ? item.draw_fixture.display_id : (int?)null; } ResultsChronological = false; if (item.draw_result?.draws != null) { ResultsChronological = item.draw_result.draws.chronologicalSpecified && item.draw_result.draws.chronological; if (item.draw_result.draws.draw != null) { var res = item.draw_result.draws.draw.Select(draw => new DrawResultDTO(draw)).ToList(); Results = res; } } GeneratedAt = item.generated_atSpecified ? item.generated_at : (DateTime?)null; }
/// <summary> /// Initializes a new instance of the <see cref="DrawSummaryMapper" /> class /// </summary> /// <param name="drawSummary">A <see cref="draw_summary" /> containing lottery draw data</param> internal DrawSummaryMapper(draw_summary drawSummary) { Contract.Requires(drawSummary != null); _drawSummary = drawSummary; }
/// <summary> /// Initializes a new instance of the <see cref="DrawSummaryMapper"/> class /// </summary> /// <param name="drawSummary">A <see cref="draw_summary"/> containing lottery draw data</param> internal DrawSummaryMapper(draw_summary drawSummary) { Guard.Argument(drawSummary, nameof(drawSummary)).NotNull(); _drawSummary = drawSummary; }