Example #1
0
 public Slot(Teacher Teacher, Student Student, DateTime DateTime)
 {
     _teacher = Teacher;
     this.Student = Student;
     this.DateTime = DateTime;
 }
Example #2
0
        /// <summary>
        /// Deletes a particular Slot
        /// </summary>
        /// <param name="Sender">The Teacher that has requested to delete the slot</param>
        /// <param name="Slot">The slot to delete</param>
        public void DeleteSlot(Teacher Sender, Slot Slot)
        {
            //Check to see if a student has already booked
            if (Slot.Student != null)
            {
                throw new SlotPermissionException(String.Format("The room is already booked by Student {0} cannot delete slot.", Slot.Student.Id));
            }

            //If this room contains this booking then remove it and also remove it from the Teacher who instigated the removal
            if (_slots.Contains(Slot))
            {
                Sender.Bookings.Remove(Slot);
                _slots.Remove(Slot);
            }
            else
            {
                throw new ArgumentException(String.Format("This slot has not been booked for this room"));
            }
        }