/// <summary> /// Converts domain object to DTO. /// </summary> /// <param name="organiser">The organiser.</param> /// <returns>Organiser DTO.</returns> public static OrganiserDto ToDto(IOrganiser organiser) { if (organiser == null) { throw new ArgumentNullException(nameof(organiser)); } return(new OrganiserDto( id: organiser.Id, code: organiser.Code, name: organiser.Name)); }
/// <inheritdoc/> public void CreateOrganiser(IOrganiser organiser) { OrganiserDto organiserDto = OrganiserDto.ToDto(organiser); this.Context.Organisers.Add(organiserDto); int count = this.Context.SaveChanges(); if (count != 1) { throw new ApplicationException($"Unexpectedly created {count} rows"); } }
/// <summary> /// Initializes a new instance of the <see cref="Season"/> class. /// </summary> /// <param name="id">Season Id.</param> /// <param name="organiser">Organiser.</param> /// <param name="description">Season Description.</param> /// <param name="startDate">Start Date.</param> /// <param name="endDate">End Date.</param> public Season( Guid id, IOrganiser organiser, string description, DateTime startDate, DateTime endDate) { this.Id = id; this.Organiser = organiser ?? throw new ArgumentNullException(nameof(organiser)); this.Description = description ?? throw new ArgumentNullException(nameof(description)); if (startDate > endDate) { throw new StartDateAfterEndDateException(startDate, endDate); } this.StartDate = startDate; this.EndDate = endDate; }
public Sizer(IOrganiser <Vector> organiser, int xFactor, int yFactor) { this.organiser = organiser; this.xFactor = xFactor; this.yFactor = yFactor; }