Esempio n. 1
0
        /// <summary> Changes all notice related to a particular existing notice.
        /// <param name="inputNotice"> object L_Notice (name of object) - This is a logic object of type notice. </param>
        /// <returns> void </returns>
        /// </summary>
        public async Task UpdateNotice(L_Notice inputNotice)
        {
            _logger.LogInformation($"Updating notice with ID {inputNotice.NoticeId}");
            D_Notice currentEntity = await _dbContext.Notices.FindAsync(inputNotice.NoticeId);

            D_Notice newEntity = Mapper.UnMapNotice(inputNotice);

            _dbContext.Entry(currentEntity).CurrentValues.SetValues(newEntity);
            Save();
        }
Esempio n. 2
0
        /// <summary> Changes all user related to a particular existing user.
        /// <param name="inputUser"> object L_User (name of object) - This is a logic object of type user. </param>
        /// <returns> void </returns>
        /// </summary>
        public async Task UpdateUser(L_User inputUser)
        {
            _logger.LogInformation($"Updating user with ID {inputUser.UserId}");
            D_User currentEntity = await _dbContext.Users.FindAsync(inputUser.UserId);

            D_User newEntity = Mapper.UnMapUser(inputUser);

            _dbContext.Entry(currentEntity).CurrentValues.SetValues(newEntity);
            Save();
        }
        /// <summary> Changes all game data related to a particular existing game data.
        /// <param name="inputGameData"> object L_GameData (name of object) - This is a logic object of type game data. </param>
        /// <returns> void </returns>
        /// </summary>
        public async Task UpdateGameData(L_GameData inputGameData)
        {
            _logger.LogInformation($"Updating game data with ID {inputGameData.DataId}");
            D_GameData currentEntity = await _dbContext.GameDatas
                                       .Include(p => p.Game)
                                       .FirstOrDefaultAsync(p => p.DataId == inputGameData.DataId);

            D_GameData newEntity = Mapper.UnMapGameData(inputGameData);

            _dbContext.Entry(currentEntity).CurrentValues.SetValues(newEntity);
            Save();
        }
Esempio n. 4
0
        /// <summary> Changes all score related to a particular existing score.
        /// <param name="inputScore"> object L_Score (name of object) - This is a logic object of type Score. </param>
        /// <returns> void </returns>
        /// </summary>
        public async Task UpdateScore(L_Score inputScore)
        {
            _logger.LogInformation($"Updating score with ID {inputScore.ScoreId}");
            D_Score currentEntity = await _dbContext.Scores
                                    .Include(p => p.User)
                                    .Include(p => p.Game)
                                    .FirstOrDefaultAsync(p => p.ScoreId == inputScore.ScoreId);

            D_Score newEntity = Mapper.UnMapScore(inputScore);

            _dbContext.Entry(currentEntity).CurrentValues.SetValues(newEntity);
            Save();
        }
Esempio n. 5
0
        /// <summary> Changes all review related to a particular existing review.
        /// <param name="reviewData"> object L_Review (name of object) - This is a logic object of type review. </param>
        /// <returns> void </returns>
        /// </summary>
        public async Task UpdateReview(L_Review inputReview)
        {
            _logger.LogInformation($"Updating review with ID {inputReview.ReviewId}");
            D_Review currentEntity = await _dbContext.Reviews
                                     .Include(p => p.User)
                                     .Include(p => p.Game)
                                     .FirstOrDefaultAsync(p => p.ReviewId == inputReview.ReviewId);

            D_Review newEntity = Mapper.UnMapReview(inputReview);

            _dbContext.Entry(currentEntity).CurrentValues.SetValues(newEntity);
            Save();
        }
Esempio n. 6
0
        /// <summary> Changes all game related to a particular existing game.
        /// <param name="inputGame"> object L_Game (name of object) - This is a logic object of type game. </param>
        /// <returns> void </returns>
        /// </summary>
        public async Task UpdateGame(L_Game inputGame)
        {
            _logger.LogInformation($"Updating game with ID {inputGame.GameId}");
            D_Game currentEntity = await _dbContext.Games
                                   .Include(p => p.Scores)
                                   .Include(p => p.Reviews)
                                   .Include(p => p.Data)
                                   .FirstOrDefaultAsync(p => p.GameId == inputGame.GameId);

            D_Game newEntity = Mapper.UnMapGame(inputGame);

            _dbContext.Entry(currentEntity).CurrentValues.SetValues(newEntity);
            Save();
        }