public Slot(Teacher Teacher, Student Student, DateTime DateTime) { _teacher = Teacher; this.Student = Student; this.DateTime = DateTime; }
/// <summary> /// Cancels a particular booking /// </summary> /// <param name="Sender">The Student reference that wants to cancel a slot</param> /// <param name="Slot">The slot to cancel for the student</param> public void CancelBooking(Student Sender, Slot Slot) { //If the booking currently exists for this student then clear it from the student and clear the student reference for that booking by the teacher Slot existing = _slots.Find(ex => ex.Teacher == Slot.Teacher && ex.Student == Slot.Student && ex.DateTime == Slot.DateTime); if (existing != null) { existing.Student = null; Sender.Bookings.Remove(existing); } else { throw new ArgumentException(String.Format("This slot has not been booked for this room")); } }