Ejemplo n.º 1
0
        public void PutArcadeMachine(ArcadeMachine arcadeMachine)
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            ArcadeMachine updatedArcadeMachine = knightsContext.ArcadeMachines.Find(arcadeMachine.ArcadeMachineId);

            if (arcadeMachine.ArcadeMachineRoom != null)
            {
                updatedArcadeMachine.ArcadeMachineRoom = arcadeMachine.ArcadeMachineRoom;
            }
            if (arcadeMachine.ArcadeMachineDescription != null)
            {
                updatedArcadeMachine.ArcadeMachineDescription = arcadeMachine.ArcadeMachineDescription;
            }
            if (arcadeMachine.ArcadeMachineCoords != null)
            {
                updatedArcadeMachine.ArcadeMachineCoords = arcadeMachine.ArcadeMachineCoords;
            }
            if (arcadeMachine.ArcadeMachineAddress != null)
            {
                updatedArcadeMachine.ArcadeMachineAddress = arcadeMachine.ArcadeMachineAddress;
            }
            if (arcadeMachine.ArcadeMachineName != null)
            {
                updatedArcadeMachine.ArcadeMachineName = arcadeMachine.ArcadeMachineName;
            }

            knightsContext.Entry <ArcadeMachine>(updatedArcadeMachine).State = EntityState.Modified;
            knightsContext.SaveChanges();
        }
Ejemplo n.º 2
0
        public void PutUser(Users updatedUserInfo)
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            Users currentUserInfo = GetUser(updatedUserInfo.Username);

            if (updatedUserInfo.UserMajor != null)
            {
                currentUserInfo.UserMajor = updatedUserInfo.UserMajor;
            }
            if (updatedUserInfo.UserLastName != null)
            {
                currentUserInfo.UserLastName = updatedUserInfo.UserLastName;
            }
            if (updatedUserInfo.UserFirstName != null)
            {
                currentUserInfo.UserFirstName = updatedUserInfo.UserFirstName;
            }
            if (updatedUserInfo.UserImagePath != null)
            {
                currentUserInfo.UserImagePath = updatedUserInfo.UserImagePath;
            }
            if (updatedUserInfo.UserEmail != null)
            {
                currentUserInfo.UserEmail = updatedUserInfo.UserEmail;
            }

            knightsContext.Entry <Users>(currentUserInfo).State = EntityState.Modified;
            knightsContext.SaveChanges();
        }
Ejemplo n.º 3
0
        public void PutSubmissions(Submissions submission)
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            Submissions updatedSubmission = GetSubmissions((int)submission.GameId);

            if (submission.SubmissionImage0 != null)
            {
                updatedSubmission.SubmissionImage0 = submission.SubmissionImage0;
            }
            if (submission.SubmissionReviewDateUtc != null)
            {
                updatedSubmission.SubmissionReviewDateUtc = submission.SubmissionReviewDateUtc;
            }
            if (submission.SubmissionStatus != null)
            {
                updatedSubmission.SubmissionStatus = submission.SubmissionStatus;
            }
            if (submission.SubmissionReviewComments != null)
            {
                updatedSubmission.SubmissionReviewComments = submission.SubmissionReviewComments;
            }
            if (submission.CreatorEmail != null)
            {
                updatedSubmission.CreatorEmail = submission.CreatorEmail;
            }

            knightsContext.Entry <Submissions>(updatedSubmission).State = EntityState.Modified;
            knightsContext.SaveChanges();
        }
Ejemplo n.º 4
0
        public void PostTestingLog(TestingLog testingLog)
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            knightsContext.TestingLog.Add(testingLog);
            knightsContext.SaveChanges();
        }
Ejemplo n.º 5
0
        public void PostGames(Games game)
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            knightsContext.Games.Add(game);
            knightsContext.SaveChanges();
        }
Ejemplo n.º 6
0
        public void PostSubmissions(Submissions submission)
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            knightsContext.Submissions.Add(submission);
            knightsContext.SaveChanges();
        }
Ejemplo n.º 7
0
        public void PutTestsQueue(TestsQueue testsQueue)
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            knightsContext.Entry <TestsQueue>(testsQueue).State = EntityState.Modified;
            knightsContext.SaveChanges();
        }
Ejemplo n.º 8
0
        public Games GetGames(string gameName)
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            Games game = knightsContext.Games.Where(x => x.GameName == gameName).ToList().FirstOrDefault();

            return(game);
        }
Ejemplo n.º 9
0
        public List <TestsQueue> GetAllTestsQueue()
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            List <TestsQueue> testsQueues = knightsContext.Testsqueue.ToList();

            return(testsQueues);
        }
Ejemplo n.º 10
0
        public TestsQueue GetTestsQueue()
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            TestsQueue testsQueue = knightsContext.Testsqueue.FirstOrDefault();

            return(testsQueue);
        }
Ejemplo n.º 11
0
        ///////
        //// Games Table
        ///////

        public Games GetGames(int gameId)
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            Games myGame = knightsContext.Games.Find(gameId);

            return(myGame);
        }
Ejemplo n.º 12
0
        ///////
        //// Tests Table
        ///////

        public Tests GetTests(int gameId)
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            Tests test = knightsContext.Tests.Find(gameId);

            return(test);
        }
Ejemplo n.º 13
0
        ///////
        //// Submissions Table
        ///////

        public Submissions GetSubmissions(int gameId)
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            Submissions submission = knightsContext.Submissions.Find(gameId);

            return(submission);
        }
Ejemplo n.º 14
0
        ///////
        //// Arcade Machines
        ///////

        public List <ArcadeMachine> GetAllArcadeMachines()
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            List <ArcadeMachine> arcadeMachines = knightsContext.ArcadeMachines.ToList();

            return(arcadeMachines);
        }
Ejemplo n.º 15
0
        public ArcadeMachine PostArcadeMachine(ArcadeMachine arcadeMachine)
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            knightsContext.ArcadeMachines.Add(arcadeMachine);
            knightsContext.SaveChanges();
            return(arcadeMachine);
        }
Ejemplo n.º 16
0
        public List <TestingLog> GetTestingLog(int gameId)
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            List <TestingLog> testingLogs = knightsContext.TestingLog.Where(x => x.GameId == gameId).ToList();

            return(testingLogs);
        }
Ejemplo n.º 17
0
        public List <Users> GetAllUsers()
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            List <Users> users = knightsContext.Users.ToList();

            return(users);
        }
Ejemplo n.º 18
0
        ///////
        //// Users
        ///////

        public Users GetUser(string username)
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            Users user = knightsContext.Users.Find(username);

            return(user);
        }
Ejemplo n.º 19
0
        public void DeleteSubmissions(int gameId)
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            Submissions submission = GetSubmissions(gameId);

            knightsContext.Submissions.Remove(submission);
            knightsContext.SaveChanges();
        }
Ejemplo n.º 20
0
        public void DeleteArcadeMachine(int?arcadeMachineId)
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            ArcadeMachine arcadeMachine = knightsContext.ArcadeMachines.Find(arcadeMachineId);

            knightsContext.ArcadeMachines.Remove(arcadeMachine);
            knightsContext.SaveChanges();
        }
Ejemplo n.º 21
0
        public void DeleteGames(int gameId)
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            Games myGame = GetGames(gameId);

            knightsContext.Games.Remove(myGame);
            knightsContext.SaveChanges();
        }
Ejemplo n.º 22
0
        public void DeleteUser(string username)
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            Users user = knightsContext.Users.Find(username);

            knightsContext.Users.Remove(user);
            knightsContext.SaveChanges();
        }
Ejemplo n.º 23
0
        public void PutTests(Tests test)
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            Tests updatedTest = GetTests((int)test.GameId);

            if (test.Test10min != null)
            {
                updatedTest.Test10min = test.Test10min;
            }
            if (test.TestAttempts != null)
            {
                updatedTest.TestAttempts = test.TestAttempts;
            }
            if (test.TestCloses != null)
            {
                updatedTest.TestCloses = test.TestCloses;
            }
            if (test.TestOpens != null)
            {
                updatedTest.TestOpens = test.TestOpens;
            }
            if (test.TestCloseOn3 != null)
            {
                updatedTest.TestCloseOn3 = test.TestCloseOn3;
            }
            if (test.TestCloseOnEscape != null)
            {
                updatedTest.TestCloseOnEscape = test.TestCloseOnEscape;
            }
            if (test.TestAverageRam != null)
            {
                updatedTest.TestAverageRam = test.TestAverageRam;
            }
            if (test.TestFolderFileNames != null)
            {
                updatedTest.TestFolderFileNames = test.TestFolderFileNames;
            }
            if (test.TestNumExeFiles != null)
            {
                updatedTest.TestNumExeFiles = test.TestNumExeFiles;
            }
            if (test.TestPeakRam != null)
            {
                updatedTest.TestPeakRam = test.TestPeakRam;
            }

            knightsContext.Entry <Tests>(updatedTest).State = EntityState.Modified;
            knightsContext.SaveChanges();
        }
Ejemplo n.º 24
0
        public void DeleteTestsQueue(int gameId)
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            TestsQueue testsQueue = knightsContext.Testsqueue.Find(gameId);

            knightsContext.Testsqueue.Remove(testsQueue);
            knightsContext.SaveChanges();
        }
Ejemplo n.º 25
0
        public void PutGames(Games game)
        {
            DbContextOptionsBuilder <KnightsArcadeContext> bootUp = new DbContextOptionsBuilder <KnightsArcadeContext>();

            bootUp.UseMySql(_configuration.GetConnectionString("KnightsArcadeDb"));
            KnightsArcadeContext knightsContext = new KnightsArcadeContext(bootUp.Options);

            Games updatedGame = GetGames((int)game.GameId);

            if (game.GameControls != null)
            {
                updatedGame.GameControls = game.GameControls;
            }
            if (game.GameDescription != null)
            {
                updatedGame.GameDescription = game.GameDescription;
            }
            if (game.GameGenreAction != null)
            {
                updatedGame.GameGenreAction = game.GameGenreAction;
            }
            if (game.GameGenreAdventure != null)
            {
                updatedGame.GameGenreAdventure = game.GameGenreAdventure;
            }
            if (game.GameGenreFighting != null)
            {
                updatedGame.GameGenreFighting = game.GameGenreFighting;
            }
            if (game.GameGenrePuzzle != null)
            {
                updatedGame.GameGenrePuzzle = game.GameGenrePuzzle;
            }
            if (game.GameGenreRacing != null)
            {
                updatedGame.GameGenreRacing = game.GameGenreRacing;
            }
            if (game.GameGenreRpg != null)
            {
                updatedGame.GameGenreRpg = game.GameGenreRpg;
            }
            if (game.GameGenreShooter != null)
            {
                updatedGame.GameGenreShooter = game.GameGenreShooter;
            }
            if (game.GameGenreSports != null)
            {
                updatedGame.GameGenreSports = game.GameGenreSports;
            }
            if (game.GameGenreStrategy != null)
            {
                updatedGame.GameGenreStrategy = game.GameGenreStrategy;
            }
            if (game.GameGenreSurvival != null)
            {
                updatedGame.GameGenreSurvival = game.GameGenreSurvival;
            }
            if (game.GameImage0 != null)
            {
                updatedGame.GameImage0 = game.GameImage0;
            }
            if (game.GameImage1 != null)
            {
                updatedGame.GameImage1 = game.GameImage1;
            }
            if (game.GameImage2 != null)
            {
                updatedGame.GameImage2 = game.GameImage2;
            }
            if (game.GameImage3 != null)
            {
                updatedGame.GameImage3 = game.GameImage3;
            }
            if (game.GameImage4 != null)
            {
                updatedGame.GameImage4 = game.GameImage4;
            }
            if (game.GameName != null)
            {
                updatedGame.GameName = game.GameName;
            }
            if (game.GamePath != null)
            {
                updatedGame.GamePath = game.GamePath;
            }
            if (game.GameStatus != null)
            {
                updatedGame.GameStatus = game.GameStatus;
            }
            if (game.GameVideoLink != null)
            {
                updatedGame.GameVideoLink = game.GameVideoLink;
            }
            if (game.GameAvailableToDownload != null)
            {
                updatedGame.GameAvailableToDownload = game.GameAvailableToDownload;
            }
            if (game.GameOnArcade != null)
            {
                updatedGame.GameOnArcade = game.GameOnArcade;
            }
            if (game.GameReviewDateUtc != null)
            {
                updatedGame.GameReviewDateUtc = game.GameReviewDateUtc;
            }
            if (game.GameCreatorEmail != null)
            {
                updatedGame.GameCreatorEmail = game.GameCreatorEmail;
            }
            if (game.GameReviewComments != null)
            {
                updatedGame.GameReviewComments = game.GameReviewComments;
            }
            if (game.GameSubmissionDateUtc != null)
            {
                updatedGame.GameSubmissionDateUtc = game.GameSubmissionDateUtc;
            }

            knightsContext.Entry <Games>(updatedGame).State = EntityState.Modified;
            knightsContext.SaveChanges();
        }