Inheritance: IAmPersistable
Exemplo n.º 1
0
 void EnsureBedIsNotAssigned(Bed bed)
 {
     if (bed != null && Registrations.Any(r => r.Bed == bed))
     {
         throw new InvalidOperationException("Cannot assign the same bed twice for the same retreat.");
     }
 }
        static string[] GetAvailableBedCodes(Bed bed, Retreat retreat, IEnumerable<Bed> beds)
        {
            var bedcodes = retreat.GetUnassignedBeds(beds).Select(x => x.Code).ToArray();
            if (bed != null) bedcodes = new[] { bed.Code }.Concat(bedcodes).ToArray();

            return bedcodes;
        }
Exemplo n.º 3
0
 void EnsureBedIsNotAssigned(Bed bed)
 {
     if (bed != null && Registrations.Any(r => r.Bed == bed))
     {
         throw new InvalidOperationException("Cannot assign the same bed twice for the same retreat.");
     }
 }
Exemplo n.º 4
0
        public virtual void AddParticipant(Participant participant, Bed bed)
        {
            EnsureRetreatIsNotFull();
            EnsureBedIsNotAssigned(bed);

            var registration = new Registration {Participant = participant, Retreat = this, Bed = bed};
            _registrations.Add(registration);
        }
Exemplo n.º 5
0
        static void FillRetreat(Retreat retreat)
        {
            for (int x = 0; x < 29; x++)
            {
                var bed = new Bed { Code = "bedcode" + x };
                var participant = new Participant();

                retreat.AddParticipant(participant, bed);
            }
        }
Exemplo n.º 6
0
        public virtual void AddParticipant(Participant participant, Bed bed)
        {
            EnsureRetreatIsNotFull();
            EnsureBedIsNotAssigned(bed);

            var registration = new Registration {
                Participant = participant, Retreat = this, Bed = bed
            };

            _registrations.Add(registration);
        }