コード例 #1
0
        //Retrieves default content based on Search criteria.
        public async Task <DashboardGameBundle> FetchGames(string gameName = null)
        {
            ViewBag.MaxRating = (int)HttpContext.Session.GetInt32("MaxRating");
            ViewBag.MinRating = (int)HttpContext.Session.GetInt32("MinRating");

            var games = new List <Game>();

            if (gameName != null)
            {
                games = await GameDBLogic.LoadGamesBasedOnSearch(gameName);
            }
            else
            {
                games = await GameDBLogic.LoadGamesBasedOnFilters(MinRating : ViewBag.MinRating, MaxRating : ViewBag.MaxRating, genre : HttpContext.Session.GetString("Genre"), platform : HttpContext.Session.GetString("Platform"));
            }
            var DashboardBundle = new DashboardGameBundle();

            if (games.Count > 0)
            {
                DashboardBundle.popularGames = await GameDBLogic.LoadPopularGames();

                DashboardBundle.genreAGames = await GameDBLogic.LoadGenreAGames();

                DashboardBundle.genreBGames = await GameDBLogic.LoadGenreBGames();

                DashboardBundle.genreCGames = await GameDBLogic.LoadGenreCGames();
            }
            DashboardBundle.games = games;

            return(DashboardBundle);
        }
コード例 #2
0
        public async Task <IActionResult> ShowGame(int gameId)
        {
            var  gamePageDetail = new GamePageDetail();
            Game game           = await GameDBLogic.ShowOneGame(gameId);

            //SaveGame(game);
            //gamePageDetail.game = await GameDBLogic.ShowOneGame(gameId);



            return(View("GameDetail", game));
        }
コード例 #3
0
        public async Task <IActionResult> FetchGenres()
        {
            var filters = await GameDBLogic.FetchGenres();

            return(Json(filters.genres));
        }