// Updates the dictionary public void UpdateDictionary() { TimeAvailableTypes = new Dictionary <TimeSpan, List <BoatType> >(); if (When.SelectedDate.HasValue) { if (int.TryParse(Duration.Text, out var durationInt)) { var duration = TimeSpan.FromMinutes(durationInt); for (var i = TimeSpan.Zero; i < new TimeSpan(0, 23, 59, 0); i += TimeSpan.FromMinutes(15)) { if (ReservationConstraints.IsValid(When.SelectedDate.Value + i, duration, _reservationService, _windowManager.UserSession.UserId).IsValid) { var availableTypes = _reservationService.AvailableBoatTypes(When.SelectedDate.Value + i, duration); if (availableTypes.Any()) { TimeAvailableTypes[i] = availableTypes; } } } } } UpdateTimeList(); UpdateBoatTypeList(); }