Example #1
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();
        }
Example #2
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();
        }
Example #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();
        }
Example #4
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();
        }
Example #5
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();
        }
Example #6
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();
        }