Пример #1
0
        public MTGCardList GetAllMagicCards()
        {
            MTGCardList model = new MTGCardList();

            using (var db = new TCGEntities())
            {
                var query    = db.MTG_Card.Select(x => x);
                var cardList = query.ToList();
                cardList.ForEach(card => model.Cards.Add(new MTGCard()
                {
                    Name          = card.card_name,
                    CMC           = (double)card.cmc,
                    MCINumber     = card.mci_number,
                    ManaCost      = card.mana_cost,
                    Id            = card.card_id,
                    Flavor        = card.flavor_text,
                    Power         = card.power,
                    Toughness     = card.toughness,
                    Rarity        = card.card_rarity,
                    Layout        = card.card_layout,
                    Types         = card.card_type.Split(' ').ToList(),
                    Subtypes      = card.card_subtype.Split(' ').ToList(),
                    Text          = card.card_text,
                    MultiverseId  = (int)card.multiverse_id,
                    Colors        = card.card_colors.Split(' ').ToList(),
                    ColorIdentity = card.card_color_identity.Split(' ').ToList(),
                    Artist        = card.card_artist,
                    Printings     = card.sets.Split(' ').ToList(),
                    Image         = ""
                }));
            }
            return(model);
        }
        public void SearchResultTester()
        {
            HomeController homeController = new HomeController();

            MTGCardList cardListModel = new MTGCardList();
            var         result        = homeController.SearchResult(cardListModel) as ViewResult;

            Assert.IsNotNull(result);
        }
Пример #3
0
        public MTGCardList GetAllMTGCards()
        {
            MTGCardList model = new MTGCardList();

            MTGCardModel testCard = new MTGCardModel();

            testCard.Card_Artist         = "Robbie Trevino";
            testCard.Card_Colors         = "Black";
            testCard.Card_Color_Identity = "B";
            testCard.Card_Id             = "9a77d560bc690a7a44ac7fb88b99ae3e57a63fc9";
            testCard.Card_Layout         = MTGLayout.NORMAL;
            testCard.Card_Name           = "Gray Merchant of Asphodel";
            testCard.Card_Rarity         = MTGRarity.COMMON;
            testCard.Card_Subtype        = "Zombie";
            testCard.Card_Text           = "When Gray Merchant of Asphodel enters the battlefield, each opponent loses X life, where X is your devotion to black. You gain life equal to the life lost this way. (Each {B} in the mana costs of permanents you control counts toward your devotion to black.)";
            testCard.Card_Type           = "Creature — Zombie";
            testCard.CMC           = 5;
            testCard.Flavor_Text   = "";
            testCard.Mana_Cost     = "{3}{B}{B}";
            testCard.MCI_Number    = "146";
            testCard.Multiverse_ID = 389541;
            testCard.Power         = "2";
            testCard.Toughness     = "4";
            testCard.Image         = testCard.Multiverse_ID + "";
            model.MTGCards.Add(testCard);

            //using (var db = new TCGEntities())
            //{
            //    var query = db.MTG_Card.Select(x => x);
            //    var cardList = query.ToList();

            //    cardList.ForEach(card => model.MTGCards.Add(new MTGCardModel()
            //    {
            //        Card_Name = card.card_name,
            //        CMC = card.cmc,
            //        MCI_Number = card.mci_number,
            //        Mana_Cost = card.mana_cost,
            //        Card_Id = card.card_id,
            //        Flavor_Text = card.flavor_text,
            //        Power = card.power,
            //        Toughness = card.toughness,
            //        Card_Rarity = (MTGRarity)Enum.Parse(typeof(MTGRarity), card.card_rarity),
            //        Card_Layout = (MTGLayout)Enum.Parse(typeof(MTGLayout), card.card_layout),
            //        Card_Type = card.card_type,
            //        Card_Subtype = card.card_subtype,
            //        Card_Text = card.card_text,
            //        Multiverse_ID = card.multiverse_id,
            //        Card_Colors = card.card_colors,
            //        Card_Color_Identity = card.card_color_identity,
            //        Card_Artist = card.card_artist,
            //        Sets = card.sets
            //    }));
            //}

            return(model);
        }
Пример #4
0
        public MTGCardList GetAllMagicCardsByTerm(string q)
        {
            MTGCardList model = new MTGCardList();

            using (var db = new TCGEntities())
            {
                var query    = db.MTG_Card.Select(x => x);
                var query2   = db.MTG_Card.Select(x => x).Where(x => x.card_artist.Contains(q) || x.flavor_text.Contains(q) || x.card_name.Contains(q) || x.card_subtype.Contains(q) || x.card_text.Contains(q) || x.card_type.Contains(q));
                var cardList = query2.ToList();
                foreach (var card in cardList)
                {
                    MTGCard newMTGCard = new MTGCard();
                    newMTGCard.Name          = card.card_name;
                    newMTGCard.CMC           = (double)card.cmc;
                    newMTGCard.MCINumber     = card.mci_number;
                    newMTGCard.ManaCost      = card.mana_cost;
                    newMTGCard.Id            = card.card_id;
                    newMTGCard.Flavor        = card.flavor_text;
                    newMTGCard.Power         = card.power;
                    newMTGCard.Toughness     = card.toughness;
                    newMTGCard.Rarity        = card.card_rarity;
                    newMTGCard.Layout        = card.card_layout;
                    newMTGCard.Types         = card.card_type.Split(' ').ToList();
                    newMTGCard.Subtypes      = card.card_subtype.Split(' ').ToList();
                    newMTGCard.Text          = card.card_text;
                    newMTGCard.MultiverseId  = (int)card.multiverse_id;
                    newMTGCard.Colors        = card.card_colors.Split(' ').ToList();
                    newMTGCard.ColorIdentity = card.card_color_identity.Split(' ').ToList();
                    newMTGCard.Artist        = card.card_artist;
                    newMTGCard.Printings     = card.sets.Split(' ').ToList();
                    newMTGCard.Image         = "";
                    if (newMTGCard.Flavor == null)
                    {
                        newMTGCard.Flavor = "";
                    }
                    if (newMTGCard.Subtypes == null)
                    {
                        newMTGCard.Subtypes[0] = "";
                    }
                    if (newMTGCard.Text == null)
                    {
                        newMTGCard.Text = "";
                    }

                    model.Cards.Add(newMTGCard);
                }
            }
            return(model);
        }
Пример #5
0
        public MTGCardList AdvancedSearch(string Name = "", string SetCode = "", string LessGreaterEqual = null, int?CMC = null, string FlavorText = null, string Power = null, string Toughness = null, string Rarity = "", string Layout = "", string Type = "", string Subtype = "", string Text = null, string Color = "", string ColorIdentity = "", string Artist = "")
        {
            MTGCardList model = new MTGCardList();

            using (var db = new TCGEntities())
            {
                var query = db.MTG_Card.Select(x => x);

                if (CMC != null)
                {
                    if (LessGreaterEqual == "=")
                    {
                        if (FlavorText != null && FlavorText != "")
                        {
                            if (Power != null && Power != "" || Toughness != null && Toughness != "")
                            {
                                if (Text != null && Text != "")
                                {
                                    query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                            .Where(x => x.cmc == CMC)
                                            .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                            //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                            .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                            .Where(x => x.power.Contains(Power)).Where(x => x.toughness.Contains(Toughness))
                                            .Where(x => x.card_text.Contains(Text)).Where(x => x.flavor_text.Contains(FlavorText))
                                            .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                            .Where(x => x.card_artist.Contains(Artist));
                                }
                                else
                                {
                                    query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                            .Where(x => x.cmc == CMC)
                                            .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                            //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                            .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                            .Where(x => x.power.Contains(Power)).Where(x => x.toughness.Contains(Toughness))
                                            .Where(x => x.flavor_text.Contains(FlavorText))
                                            .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                            .Where(x => x.card_artist.Contains(Artist));
                                }
                            }
                            else
                            {
                                if (Text != null && Text != "")
                                {
                                    query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                            .Where(x => x.cmc == CMC)
                                            .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                            //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                            .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                            .Where(x => x.card_text.Contains(Text)).Where(x => x.flavor_text.Contains(FlavorText))
                                            .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                            .Where(x => x.card_artist.Contains(Artist));
                                }
                                else
                                {
                                    query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                            .Where(x => x.cmc == CMC)
                                            .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                            //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                            .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                            .Where(x => x.flavor_text.Contains(FlavorText))
                                            .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                            .Where(x => x.card_artist.Contains(Artist));
                                }
                            }
                        }
                        else
                        {
                            if (Power != null && Power != "" || Toughness != null && Toughness != "")
                            {
                                if (Text != null && Text != "")
                                {
                                    query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                            .Where(x => x.cmc == CMC)
                                            .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                            //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                            .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                            .Where(x => x.power.Contains(Power)).Where(x => x.toughness.Contains(Toughness))
                                            .Where(x => x.card_text.Contains(Text))
                                            .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                            .Where(x => x.card_artist.Contains(Artist));
                                }
                                else
                                {
                                    query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                            .Where(x => x.cmc == CMC)
                                            .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                            //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                            .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                            .Where(x => x.power.Contains(Power)).Where(x => x.toughness.Contains(Toughness))
                                            .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                            .Where(x => x.card_artist.Contains(Artist));
                                }
                            }
                            else
                            {
                                if (Text != null && Text != "")
                                {
                                    query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                            .Where(x => x.cmc == CMC)
                                            .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                            //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                            .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                            .Where(x => x.card_text.Contains(Text))
                                            .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                            .Where(x => x.card_artist.Contains(Artist));
                                }
                                else
                                {
                                    query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                            .Where(x => x.cmc == CMC)
                                            .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                            //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                            .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                            .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                            .Where(x => x.card_artist.Contains(Artist));
                                }
                            }
                        }
                    }
                    else if (LessGreaterEqual == ">")
                    {
                        if (FlavorText != null && FlavorText != "")
                        {
                            if (Power != null && Power != "" || Toughness != null && Toughness != "")
                            {
                                if (Text != null && Text != "")
                                {
                                    query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                            .Where(x => x.cmc > CMC)
                                            .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                            //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                            .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                            .Where(x => x.power.Contains(Power)).Where(x => x.toughness.Contains(Toughness))
                                            .Where(x => x.card_text.Contains(Text)).Where(x => x.flavor_text.Contains(FlavorText))
                                            .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                            .Where(x => x.card_artist.Contains(Artist));
                                }
                                else
                                {
                                    query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                            .Where(x => x.cmc > CMC)
                                            .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                            //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                            .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                            .Where(x => x.power.Contains(Power)).Where(x => x.toughness.Contains(Toughness))
                                            .Where(x => x.flavor_text.Contains(FlavorText))
                                            .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                            .Where(x => x.card_artist.Contains(Artist));
                                }
                            }
                            else
                            {
                                if (Text != null && Text != "")
                                {
                                    query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                            .Where(x => x.cmc > CMC)
                                            .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                            //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                            .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                            .Where(x => x.card_text.Contains(Text)).Where(x => x.flavor_text.Contains(FlavorText))
                                            .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                            .Where(x => x.card_artist.Contains(Artist));
                                }
                                else
                                {
                                    query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                            .Where(x => x.cmc > CMC)
                                            .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                            //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                            .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                            .Where(x => x.flavor_text.Contains(FlavorText))
                                            .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                            .Where(x => x.card_artist.Contains(Artist));
                                }
                            }
                        }
                        else
                        {
                            if (Power != null && Power != "" || Toughness != null && Toughness != "")
                            {
                                if (Text != null && Text != "")
                                {
                                    query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                            .Where(x => x.cmc > CMC)
                                            .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                            //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                            .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                            .Where(x => x.power.Contains(Power)).Where(x => x.toughness.Contains(Toughness))
                                            .Where(x => x.card_text.Contains(Text))
                                            .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                            .Where(x => x.card_artist.Contains(Artist));
                                }
                                else
                                {
                                    query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                            .Where(x => x.cmc > CMC)
                                            .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                            //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                            .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                            .Where(x => x.power.Contains(Power)).Where(x => x.toughness.Contains(Toughness))
                                            .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                            .Where(x => x.card_artist.Contains(Artist));
                                }
                            }
                            else
                            {
                                if (Text != null && Text != "")
                                {
                                    query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                            .Where(x => x.cmc > CMC)
                                            .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                            //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                            .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                            .Where(x => x.card_text.Contains(Text))
                                            .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                            .Where(x => x.card_artist.Contains(Artist));
                                }
                                else
                                {
                                    query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                            .Where(x => x.cmc > CMC)
                                            .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                            //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                            .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                            .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                            .Where(x => x.card_artist.Contains(Artist));
                                }
                            }
                        }
                    }
                    else
                    {
                        if (FlavorText != null && FlavorText != "")
                        {
                            if (Power != null && Power != "" || Toughness != null && Toughness != "")
                            {
                                if (Text != null && Text != "")
                                {
                                    query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                            .Where(x => x.cmc < CMC)
                                            .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                            //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                            .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                            .Where(x => x.power.Contains(Power)).Where(x => x.toughness.Contains(Toughness))
                                            .Where(x => x.card_text.Contains(Text)).Where(x => x.flavor_text.Contains(FlavorText))
                                            .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                            .Where(x => x.card_artist.Contains(Artist));
                                }
                                else
                                {
                                    query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                            .Where(x => x.cmc < CMC)
                                            .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                            //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                            .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                            .Where(x => x.power.Contains(Power)).Where(x => x.toughness.Contains(Toughness))
                                            .Where(x => x.flavor_text.Contains(FlavorText))
                                            .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                            .Where(x => x.card_artist.Contains(Artist));
                                }
                            }
                            else
                            {
                                if (Text != null && Text != "")
                                {
                                    query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                            .Where(x => x.cmc < CMC)
                                            .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                            //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                            .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                            .Where(x => x.card_text.Contains(Text)).Where(x => x.flavor_text.Contains(FlavorText))
                                            .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                            .Where(x => x.card_artist.Contains(Artist));
                                }
                                else
                                {
                                    query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                            .Where(x => x.cmc < CMC)
                                            .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                            //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                            .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                            .Where(x => x.flavor_text.Contains(FlavorText))
                                            .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                            .Where(x => x.card_artist.Contains(Artist));
                                }
                            }
                        }
                        else
                        {
                            if (Power != null && Power != "" || Toughness != null && Toughness != "")
                            {
                                if (Text != null && Text != "")
                                {
                                    query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                            .Where(x => x.cmc < CMC)
                                            .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                            //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                            .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                            .Where(x => x.power.Contains(Power)).Where(x => x.toughness.Contains(Toughness))
                                            .Where(x => x.card_text.Contains(Text))
                                            .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                            .Where(x => x.card_artist.Contains(Artist));
                                }
                                else
                                {
                                    query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                            .Where(x => x.cmc < CMC)
                                            .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                            //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                            .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                            .Where(x => x.power.Contains(Power)).Where(x => x.toughness.Contains(Toughness))
                                            .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                            .Where(x => x.card_artist.Contains(Artist));
                                }
                            }
                            else
                            {
                                if (Text != null && Text != "")
                                {
                                    query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                            .Where(x => x.cmc < CMC)
                                            .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                            //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                            .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                            .Where(x => x.card_text.Contains(Text))
                                            .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                            .Where(x => x.card_artist.Contains(Artist));
                                }
                                else
                                {
                                    query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                            .Where(x => x.cmc < CMC)
                                            .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                            //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                            .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                            .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                            .Where(x => x.card_artist.Contains(Artist));
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (FlavorText != null && FlavorText != "")
                    {
                        if (Power != null && Power != "" || Toughness != null && Toughness != "")
                        {
                            if (Text != null && Text != "")
                            {
                                query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                        .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                        //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                        .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                        .Where(x => x.power.Contains(Power)).Where(x => x.toughness.Contains(Toughness))
                                        .Where(x => x.card_text.Contains(Text)).Where(x => x.flavor_text.Contains(FlavorText))
                                        .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                        .Where(x => x.card_artist.Contains(Artist));
                            }
                            else
                            {
                                query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                        .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                        //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                        .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                        .Where(x => x.power.Contains(Power)).Where(x => x.toughness.Contains(Toughness))
                                        .Where(x => x.flavor_text.Contains(FlavorText))
                                        .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                        .Where(x => x.card_artist.Contains(Artist));
                            }
                        }
                        else
                        {
                            if (Text != null && Text != "")
                            {
                                query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                        .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                        //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                        .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                        .Where(x => x.card_text.Contains(Text)).Where(x => x.flavor_text.Contains(FlavorText))
                                        .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                        .Where(x => x.card_artist.Contains(Artist));
                            }
                            else
                            {
                                query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                        .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                        //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                        .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                        .Where(x => x.flavor_text.Contains(FlavorText))
                                        .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                        .Where(x => x.card_artist.Contains(Artist));
                            }
                        }
                    }
                    else
                    {
                        if (Power != null && Power != "" || Toughness != null && Toughness != "")
                        {
                            if (Text != null && Text != "")
                            {
                                query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                        .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                        //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                        .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                        .Where(x => x.power.Contains(Power)).Where(x => x.toughness.Contains(Toughness))
                                        .Where(x => x.card_text.Contains(Text))
                                        .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                        .Where(x => x.card_artist.Contains(Artist));
                            }
                            else
                            {
                                query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                        .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                        //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                        .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                        .Where(x => x.power.Contains(Power)).Where(x => x.toughness.Contains(Toughness))
                                        .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                        .Where(x => x.card_artist.Contains(Artist));
                            }
                        }
                        else
                        {
                            if (Text != null && Text != "")
                            {
                                query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                        .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                        //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                        .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                        .Where(x => x.card_text.Contains(Text))
                                        .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                        .Where(x => x.card_artist.Contains(Artist));
                            }
                            else
                            {
                                query = db.MTG_Card.Select(x => x).Where(x => x.card_name.Contains(Name)).Where(x => x.sets.Contains(SetCode))
                                        .Where(x => x.card_rarity.Contains(Rarity)).Where(x => x.card_layout.Contains(Layout))
                                        //vv       THIS   IS   BUSTED       vv  vv               THIS   TOO              vv
                                        .Where(x => x.card_type.Contains(Type)).Where(x => x.card_subtype.Contains(Subtype))
                                        .Where(x => x.card_colors.Contains(Color)).Where(x => x.card_color_identity.Contains(ColorIdentity))
                                        .Where(x => x.card_artist.Contains(Artist));
                            }
                        }
                    }
                }
                var cardList = query.OrderBy(x => x.card_name).ToList();
                cardList.ForEach(card => model.Cards.Add(new MTGCard()
                {
                    Name          = card.card_name,
                    CMC           = (double)card.cmc,
                    MCINumber     = card.mci_number,
                    ManaCost      = card.mana_cost,
                    Id            = card.card_id,
                    Flavor        = card.flavor_text,
                    Power         = card.power,
                    Toughness     = card.toughness,
                    Rarity        = card.card_rarity,
                    Layout        = card.card_layout,
                    Types         = card.card_type.Split(' ').ToList(),
                    Subtypes      = card.card_subtype.Split(' ').ToList(),
                    Text          = card.card_text,
                    MultiverseId  = (int)card.multiverse_id,
                    Colors        = card.card_colors.Split(' ').ToList(),
                    ColorIdentity = card.card_color_identity.Split(' ').ToList(),
                    Artist        = card.card_artist,
                    Printings     = card.sets.Split(' ').ToList(),
                    Image         = ""
                }));
            }
            return(model);
        }