public bool IsTimeslotsOverlapping(List <Timeslot> timeslotsWhereTeacherIsPresent, Timeslot newTimeslot) { if (timeslotsWhereTeacherIsPresent.Count == 0) { return(false); } var result = timeslotsWhereTeacherIsPresent.All(existingTimeslots => newTimeslot.Range.From >= existingTimeslots.Range.To || newTimeslot.Range.To <= existingTimeslots.Range.From); return(result); }
public void CreateTimeSlot(Timeslot timeslot) { this.Timeslots.Add(timeslot); }
public bool IsTimeslotsOverlapping(List <Timeslot> timeslotsWhereTeacherIsPresent, Timeslot newTimeslot) { var result = timeslotsWhereTeacherIsPresent.All(existingTimeslots => newTimeslot.From >= existingTimeslots.To || newTimeslot.To <= existingTimeslots.From); return(result); }