Exemplo n.º 1
0
        public List <int> GetListOfAllMovieIdsInDatabase()
        {
            int        numberOfMoviesInDatabase = _getMovieInfoFromDatabase.GetCountOfMoviesInDb();
            List <int> movieIdsInDatabase       = new List <int> ();

            for (var movieId = 1; movieId <= numberOfMoviesInDatabase; movieId++)
            {
                movieIdsInDatabase.Add(movieId);
            }
            return(movieIdsInDatabase);
        }
Exemplo n.º 2
0
        public int IdentifyThisGamesMovieId()
        {
            _h.StartMethod();
            int?playerId = HttpContext.Session.GetInt32("id");

            Console.WriteLine($"playerId: {playerId}");
            User player = _context.Users.Include(m => m.MovieUserJoin).SingleOrDefault(p => p.UserId == playerId);

            Console.WriteLine($"player: {player}");

            // GAMES WON --> how many games has the player won; the next movie served is based off of this
            var playersGamesWon          = ViewBag.GamesWon = player.GamesWon;
            int currentMovieId           = playersGamesWon + 1;
            int numberOfMoviesInDatabase = _getMovieInfo.GetCountOfMoviesInDb();

            // Console.WriteLine($"IdentifyThisGamesMovie() : player has won {playersGamesWon} games");

            if (currentMovieId > numberOfMoviesInDatabase)
            {
                RedirectPlayersOutOfMovies(numberOfMoviesInDatabase);
            }

            return(currentMovieId);
        }