示例#1
0
        public ActionResult Index()
        {
            List <MyDecks> decks = _deckData.GetMyDecks(User.Identity.Name);

            decks.ForEach(d =>
            {
                d.URL    = Url.Action("DeckDetail", "Decks", new { DeckId = d.Id });
                d.Colors = _deckData.GetDeckColors(d.Id);
            });

            var vm = new DeckModel()
            {
                Decks = decks,
            };

            return(View(vm));
        }
        public ActionResult Index()
        {
            var cards = _cardData.GetAllCards();

            cards.ForEach(c =>
            {
                c.src      = "http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=" + c.ID + "&type=card";
                c.url      = Url.Action("CardDetail", "Cards", new { ID = c.ID });
                c.Hovering = false;
            });

            var vm = new AllCardsHomeModel()
            {
                Title               = _setData.MostRecentExpansion().First().Name,
                AdvancedSearch      = false,
                Search              = true,
                SelectedCard        = 0,
                Sets                = _setData.GetAllSets(),
                AllSets             = _setData.GetAllSets(false),
                SetOperator         = "AND",
                SetList             = new List <SearchList>(),
                AllNames            = null,
                NameOperator        = "AND",
                NameList            = new List <SearchList>(),
                AllTypes            = _cardData.GetAllTypes(),
                TypeOperator        = "AND",
                TypeList            = new List <SearchList>(),
                AllSubTypes         = _cardData.GetAllSubTypes(),
                SubTypeOperator     = "AND",
                SubTypeList         = new List <SearchList>(),
                ManaCostOperator    = "AND",
                ManaCostComparison  = "=",
                ManaCostList        = new List <SearchList>(),
                PowerOperator       = "AND",
                PowerComparison     = "=",
                PowerList           = new List <SearchList>(),
                ToughnessOperator   = "AND",
                ToughnessComparison = "=",
                ToughnessList       = new List <SearchList>(),
                AllRaritys          = _cardData.GetAllRaritys(),
                RarityOperator      = "AND",
                RarityList          = new List <SearchList>(),
                TextOperator        = "AND",
                TextList            = new List <SearchList>(),
                ArtistOperator      = "AND",
                ArtistList          = new List <SearchList>(),

                Colors = new ColorSelector()
                {
                    White     = false,
                    Blue      = false,
                    Black     = false,
                    Red       = false,
                    Green     = false,
                    Colorless = false
                },
                ManaOperator = "OR",
                Cards        = cards,
                Decks        = _deckData.GetMyDecks(User.Identity.Name),
                Loading      = true,
                CardAmounts  = new CardAmounts(),
                Settings     = false,
                ColSize      = "col-md-3"
            };

            return(View(vm));
        }