Example #1
0
        public IActionResult Details(int id)
        {
            if (id == 0)
            {
                return(NotFound());
            }

            Game game = gameService.GetByID(id);

            if (game == null)
            {
                return(NotFound());
            }

            GameDetailsViewModel viewModel = new GameDetailsViewModel
            {
                Game         = game,
                Genre        = genreService.GetByID(game.GenreID),
                Developer    = developerService.GetByID(game.DeveloperID),
                Publisher    = publisherService.GetByID(game.PublisherID),
                Platform     = platformService.GetByID(game.PlatformID),
                Review       = reviewService.GetByID(game.Reviews.Select(x => x.GameID = game.ID).FirstOrDefault()),
                SignedInUser = userManager.GetUserAsync(HttpContext.User).Result ?? null
            };

            return(View(viewModel));
        }
        public IActionResult Details(int id)
        {
            if (id == 0)
            {
                return(NotFound());
            }

            Platform platform = platformService.GetByID(id);

            if (platform == null)
            {
                return(NotFound());
            }

            PlatformType platformType = platformTypeService.GetByID((int)platform.PlatformTypeID);

            PlatformDetailsViewModel viewModel = new PlatformDetailsViewModel
            {
                Platform     = platform,
                PlatformType = platformType ?? null
            };

            return(View(viewModel));
        }