private void Button_Click(object sender, RoutedEventArgs e) { User usr = new User(); bool isUsed = false; List <User> allUsers = _userRepo.getAllUsers(); usr.Login = LoginBox.Text; usr.Password = _PasswordBox.Password; foreach (var usrs in allUsers) { if (usr.Login == usrs.Login) { LoginBox.Clear(); _PasswordBox.Clear(); isUsed = true; } } if (isUsed) { MessageBox.Show("This login is already used"); } else { _userRepo.RegisterUser(usr); _buyService.BuyGame(_gameRepo.FindByFullName("CSGO"), usr); new LibraryPage(_gameRepo, _userRepo, _buyService, _calcStrat, null, usr).Show(); this.Hide(); } }
private void GamePlayButton_Click(object sender, RoutedEventArgs e) { _buyService.BuyGame(_gameRepo.FindByFullName(selectedGame.Name), storeUser); }