示例#1
0
        /// <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));
        }
示例#2
0
文件: Create.cs 项目: dev027/Dealing
        /// <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");
            }
        }
示例#3
0
文件: Season.cs 项目: dev027/Dealing
        /// <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;
        }
示例#4
0
 public Sizer(IOrganiser <Vector> organiser, int xFactor, int yFactor)
 {
     this.organiser = organiser;
     this.xFactor   = xFactor;
     this.yFactor   = yFactor;
 }