private void Load_Data(object sender, RoutedEventArgs e) { GamePlatforms platformToSearch = platformComboBox.SelectedItem as GamePlatforms; var videoGameList = service.SearchByPlatform(platformToSearch.Name); dataGrid.ItemsSource = videoGameList.OrderBy(o => o.Title); totalGameCountLabel.Content = videoGameList.Count(); }
private void Add_Game_On_Click(object sender, RoutedEventArgs e) { GamePlatforms gamePlatformSelected = platformComboBox.SelectedItem as GamePlatforms; string gameTitle = addGameTitleTextBox.Text; string gameEdition = addGameEditionTextBox.Text; string gamePlatform = gamePlatformSelected.Name; var item = addGameYearComboBox.SelectedItem as ComboBoxItem; int gameYear = int.Parse(item.Content.ToString()); controller.AddGameToLibrary(gameTitle, gameEdition, gamePlatform, gameYear); }