private void BtnCreate_Click(object sender, RoutedEventArgs e) { try { LaundryRoom laundryRoom = null; if ((LaundryRoom)LbLaundryRooms.SelectedItem != null) { laundryRoom = (LaundryRoom)LbLaundryRooms.SelectedItem; } else { throw new Exception("Please pick a laundry"); } LaundryUser laundryUser = Service.Service.CreateLaundryUser(laundryRoom, TextUserName.Text); TextException.Text = "User: "******" has been created and assigned " + laundryUser.LaundryRoom1 + " as Laundryroom"; LbUsers.ItemsSource = Service.Service.GetUsers(laundryRoom); } catch (Exception e1) { TextException.Text = e1.Message; } }
private void LbLaundryRooms_SelectionChanged(object sender, SelectionChangedEventArgs e) { LaundryRoom laundryRoom = (LaundryRoom)LbLaundryRooms.SelectedItem; LbUsers.ItemsSource = Service.Service.GetUsers(laundryRoom); }