Exemple #1
0
        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;
        }
Exemple #2
0
        public RegattaDTO(IRegatta regatta)
        {
            if (regatta.Id < 0)
            {
                throw new ArgumentOutOfRangeException($"{nameof(regatta.Id)} cannot be less than 0.");
            }
            ValidateInParameters(regatta.Name, regatta.StartDate, regatta.EndDate, regatta.Fee, regatta.Club.Id, regatta.Address.Id);
            AddressDTO address = new AddressDTO(regatta.Address);
            ClubDTO    club    = new ClubDTO(regatta.Club);

            Id           = regatta.Id;
            Name         = regatta.Name;
            StartDate    = regatta.StartDate;
            EndDate      = regatta.EndDate;
            Fee          = regatta.Fee;
            Description  = regatta.Description;
            ClubId       = club.Id;
            AddressId    = address.Id;
            Address      = address;
            Club         = club;
            Active       = regatta.Active;
            this.sa_Info = regatta.sa_Info;
        }