コード例 #1
0
ファイル: Main.cs プロジェクト: the-magic-wombat/game-catalog
        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);
            }
        }