Exemple #1
0
        public async Task <IActionResult> ViewCollection(int id)
        {
            var collection = await _context.Collections.SingleOrDefaultAsync(c => c.ID == id);

            var connections = await _context.CollectionRecipes.Where(cr => cr.Collection == collection).Include(cr => cr.Recipe).ToListAsync();

            ViewCollectionViewModel vcvm = new ViewCollectionViewModel {
                Collection = collection, Rows = new List <Row>()
            };

            int count = 0;
            Row r     = new Row();

            foreach (CollectionRecipe cr in connections)
            {
                switch (count)
                {
                case 0:
                    r.r1 = cr.Recipe;
                    count++;
                    break;

                case 1:
                    r.r2 = cr.Recipe;
                    count++;
                    break;

                case 2:
                    r.r3 = cr.Recipe;
                    count++;
                    break;

                case 3:
                    r.r4 = cr.Recipe;
                    count++;
                    break;

                case 4:
                    vcvm.Rows.Add(r);
                    count = 0;
                    r     = new Row();
                    break;
                }
            }

            if (count != 0)
            {
                vcvm.Rows.Add(r);
            }

            return(View(vcvm));
        }
        public IActionResult ViewCollection(int?id = 1)
        {
            CollectionModel model = _context.CollectionModels.Single(x => x.ID == id);
            var             cards = _context.CardCollectionModels
                                    .Include(x => x.CardModel)
                                    .Where(x => x.CollectionModelID == id)
                                    .ToList();

            ViewCollectionViewModel viewModel = new ViewCollectionViewModel()
            {
                CollectionModel         = model,
                Cards                   = cards,
                TotalMarketPrice        = GetTotalPrice(cards, "market"),
                TotalMedianPrice        = GetTotalPrice(cards, "median"),
                TotalBuylistMarketPrice = GetTotalPrice(cards, "buylist")
            };

            return(View(viewModel));
        }
Exemple #3
0
        public ActionResult Details(string link)
        {
            //temporary for testing
            var collection = new ViewCollectionViewModel()
            {
                CollectionLink = "superheroes-by-zorbane",
                Description    = "Missions by Zorbane that are inspired by the Marvel Cinematic Universe.  These missions can be played in any order except for the finale mission, UNKNOWN MISSION NAME. Missions by Zorbane that are inspired by the Marvel Cinematic Universe.These missions can be played in any order except for the finale mission, UNKNOWN MISSION NAME. Missions by Zorbane that are inspired by the Marvel Cinematic Universe.  These missions can be played in any order except for the finale mission, UNKNOWN MISSION NAME. Missions by Zorbane that are inspired by the Marvel Cinematic Universe.  These missions can be played in any order except for the finale mission, UNKNOWN MISSION NAME. Missions by Zorbane that are inspired by the Marvel Cinematic Universe.These missions can be played in any order except for the finale mission, UNKNOWN MISSION NAME. Missions by Zorbane that are inspired by the Marvel Cinematic Universe.  These missions can be played in any order except for the finale mission, UNKNOWN MISSION NAME.",
                Id             = 1,
                ImageLink      = MissionCollectionHelper.GetImageLink("pic.jpg", 1),
                Name           = "Superheroes by Zorbane",
                AuthorTag      = db.Users.FirstOrDefault(u => u.CrypticTag.Equals("Zorbane")).CrypticTag,
                Missions       = new List <ListMissionViewModel>(),
            };

            var missions = new List <Mission>();

            missions.Add(db.Missions.Where(m => m.Name.Equals("The Improbable Bulk")).Single());
            missions.Add(db.Missions.Where(m => m.Name.Equals("Duritanium Man")).Single());

            collection.Missions = MissionHelper.GetListMissionViewModels(missions);

            return(View(collection));
        }