Exemplo n.º 1
0
        private List <Game> GameFilter()
        {
            List <Game> games          = gameBusiness.GetAll();
            List <Game> games_filtered = new List <Game>();

            if (comboBox_genre.Text == "" && comboBox_developer.Text == "")
            {
                return(games);
            }
            else if (comboBox_genre.Text != "" && comboBox_developer.Text == "")
            {
                games = gameBusiness.FindByGenre(comboBox_genre.Text);
                return(games);
            }
            else if (comboBox_genre.Text == "" && comboBox_developer.Text != "")
            {
                games = gameBusiness.FindByDeveloper(comboBox_developer.Text);
                return(games);
            }
            else
            {
                foreach (var game in games)
                {
                    if (game.Genre == comboBox_genre.Text && game.Developer == comboBox_developer.Text)
                    {
                        games_filtered.Add(game);
                    }
                }
                return(games_filtered);
            }
        }
Exemplo n.º 2
0
        private void btn_filter_Click(object sender, EventArgs e)
        {
            listBox_games.Items.Clear();

            List <Game> games = gameBusiness.FindByGenre(comboBox_genre.Text);

            foreach (var item in games)
            {
                listBox_games.Items.Add(item.Name);
            }
        }