private void OnRemoveTimeSlot(TimeSlot timeSlot) { if (UnavailableDayPeriods.ContainsKey(timeSlot.Day)) { UnavailableDayPeriods[timeSlot.Day].Remove(timeSlot.Period); if (UnavailableDayPeriods[timeSlot.Day].Count == 0) { UnavailableDayPeriods.Remove(timeSlot.Day); } } }
private void OnAddTimeSlot(TimeSlot timeSlot) { if (!UnavailableDayPeriods.ContainsKey(timeSlot.Day)) { UnavailableDayPeriods.Add(timeSlot.Day, new HashSet <int> { timeSlot.Period }); } else { UnavailableDayPeriods[timeSlot.Day].Add(timeSlot.Period); } }