private void ConfirmButton_Click(object sender, RoutedEventArgs e) { if (RecipientsListBox.SelectedItems.Count == 0) { return; } int id = _notificationController.GetAll().Count; Notification newNotification = new Notification(id, NotificationTitle, NotificationContent, DateTime.Now); List <string> selectedRecipients = RecipientsListBox.SelectedItems.Cast <string>().ToList(); newNotification.FillRecipients(selectedRecipients); _notificationController.Create(newNotification); _parent.UpdateTable(); Close(); }
public void UpdateTable() { Notifications = new List <Notification>(); foreach (Notification notification in _notificationController.GetAll()) { if (notification.IsDirectedTo(_currentSecretary.Username)) { if (!notification.IsDeleted) { Notifications.Add(notification); } } } NotificationListView.ItemsSource = Notifications; }