private void EditFavouritesClick(object sender, RoutedEventArgs e) { UserFavouriteWindow userFavourite = new UserFavouriteWindow(ActiveUser); userFavourite.Show(); Close(); }
private void ConfirmClick(object sender, RoutedEventArgs e) { var selectedStation = listBoxAllStations.SelectedItem as Station; if (selectedStation == null) { MessageBox.Show("Select a station"); } else if (ActiveUser.FavouriteStations.Any(f => f.Station.Name == selectedStation.Name)) { MessageBox.Show("Chosen Station is already in the favourites"); } else { var result = MessageBox.Show($"Would you really like to add {selectedStation.Name} station to your favourites?", "Confirm", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { using (UnitOfWork UOW = new UnitOfWork()) { UOW.Users.AddUserFavourite(ActiveUser, selectedStation); UOW.Complete(); } } UserFavouriteWindow userFavouriteWindow = new UserFavouriteWindow(ActiveUser); userFavouriteWindow.Show(); Close(); } }
private void CancelClick(object sender, RoutedEventArgs e) { UserFavouriteWindow userFavouriteWindow = new UserFavouriteWindow(ActiveUser); userFavouriteWindow.Show(); Close(); }
private void ConfirmClick(object sender, RoutedEventArgs e) { if (textBoxDescription.Text.Count() > 15) { MessageBox.Show("Your description must be less then 15 characters"); textBoxDescription.Clear(); return; } using (UnitOfWork unitOfWork = new UnitOfWork()) { unitOfWork.Users.EditUserFavourite(ActiveUser, FavouriteStation, textBoxDescription.Text); } UserFavouriteWindow userFavouriteWindow = new UserFavouriteWindow(ActiveUser); userFavouriteWindow.Show(); Close(); }