public EntryDTO(IEntry entry) { if (entry.Id < 0) { throw new ArgumentOutOfRangeException($"{nameof(entry.Id)} cannot be less than 0."); } ValidateInParameters(entry.EntryNo, entry.EntryName, entry.RegistrationDate, entry.PaidAmount, entry.Boat.Id, entry.User.Id, entry.Club.Id); var boat = new BoatDTO(entry.Boat); var club = new ClubDTO(entry.Club); var user = new UserDTO(entry.User); var regatta = new RegattaDTO(entry.Regatta); Id = entry.Id; EntryNo = entry.EntryNo; EntryName = entry.EntryName; RegistrationDate = entry.RegistrationDate; PaidAmount = entry.PaidAmount; BoatId = entry.Boat.Id; ResponsibleUserId = entry.User.Id; ClubRepresentationId = entry.Club.Id; RegattaId = entry.Regatta.Id; Boat = boat; Regatta = Regatta; Club = club; User = user; Regatta = regatta; Active = entry.Active; sa_Info = entry.sa_Info; }
public RaceEventDTO(IRaceEvent raceEvent) { if (raceEvent.Id < 0) { throw new ArgumentOutOfRangeException($"{nameof(raceEvent.Id)} cannot be less than 0."); } RegattaDTO regatta = new RegattaDTO(raceEvent.Regatta); ValidateInParameters(raceEvent.Name, raceEvent.Location, raceEvent.Fee, raceEvent.StartDate, raceEvent.EndDate, raceEvent.MaxParticipants, raceEvent.Regatta.Id, raceEvent.Class, raceEvent.Type); Id = raceEvent.Id; Name = raceEvent.Name; Location = raceEvent.Location; Fee = raceEvent.Fee; Description = raceEvent.Description; StartDate = raceEvent.StartDate; EndDate = raceEvent.EndDate; MaxParticipants = raceEvent.MaxParticipants; RegattaId = raceEvent.Regatta.Id; Active = raceEvent.Active; sa_Info = raceEvent.sa_Info; Regatta = regatta; Class = raceEvent.Class; Type = raceEvent.Type; }
public SocialEventDTO(ISocialEvent socialEvent) { if (socialEvent.Id < 0) { throw new ArgumentOutOfRangeException($"{nameof(socialEvent.Id)} cannot be less than 0."); } RegattaDTO regatta = new RegattaDTO(socialEvent.Regatta); ValidateInParameters(socialEvent.Name, socialEvent.Location, socialEvent.Fee, socialEvent.StartDate, socialEvent.EndDate, socialEvent.MaxParticipants, socialEvent.Regatta.Id); Id = socialEvent.Id; Name = socialEvent.Name; Location = socialEvent.Location; Fee = socialEvent.Fee; Description = socialEvent.Description; StartDate = socialEvent.StartDate; EndDate = socialEvent.EndDate; MaxParticipants = socialEvent.MaxParticipants; RegattaId = socialEvent.Regatta.Id; Active = socialEvent.Active; sa_Info = socialEvent.sa_Info; Regatta = regatta; }