/// <summary> Deletes one game data related to a game data id. /// <param name="gameDataId"> int (game data id) </param> /// <returns> void </returns> /// </summary> public async Task DeleteGameDataById(int gameDataId) { _logger.LogInformation($"Deleting game data with ID {gameDataId}"); D_GameData entity = await _dbContext.GameDatas .Include(p => p.Game) .FirstOrDefaultAsync(p => p.DataId == gameDataId); if (entity == null) { _logger.LogInformation($"Game data ID {gameDataId} not found to delete! : Returning."); return; } _dbContext.Remove(entity); Save(); }
/// <summary> Deletes one score related to a score id. /// <param name="scoreId"> int (score id) </param> /// <returns> void </returns> /// </summary> public async Task DeleteScoreById(int scoreId) { _logger.LogInformation($"Deleting score with ID {scoreId}"); D_Score entity = await _dbContext.Scores .Include(p => p.User) .Include(p => p.Game) .FirstOrDefaultAsync(p => p.ScoreId == scoreId); if (entity == null) { _logger.LogInformation($"Score ID {scoreId} not found to delete! : Returning."); return; } _dbContext.Remove(entity); Save(); }
/// <summary> Deletes one review related to a review id. /// <param name="reviewId"> int (review id) </param> /// <returns> void </returns> /// </summary> public async Task DeleteReviewById(int reviewId) { _logger.LogInformation($"Deleting review with ID {reviewId}"); D_Review entity = await _dbContext.Reviews .Include(p => p.User) .Include(p => p.Game) .FirstOrDefaultAsync(p => p.ReviewId == reviewId); if (entity == null) { _logger.LogInformation($"Review ID {reviewId} not found to delete! : Returning."); return; } _dbContext.Remove(entity); Save(); }
/// <summary> Deletes one notice related to a notice id. /// <param name="noticeId"> int (notice id) </param> /// <returns> void </returns> /// </summary> public async Task DeleteNoticeById(int noticeId) { _logger.LogInformation($"Deleting notice with ID {noticeId}"); D_Notice entity = await _dbContext.Notices.FindAsync(noticeId); if (entity == null) { _logger.LogInformation($"Notice ID {noticeId} not found to delete! : Returning."); return; } _dbContext.Remove(entity); Save(); }
/// <summary> Deletes one user related to a user id. /// <param name="userId"> int (user id) </param> /// <returns> void </returns> /// </summary> public async Task DeleteUserById(int userId) { _logger.LogInformation($"Deleting user with ID {userId}"); D_User entity = await _dbContext.Users.FindAsync(userId); if (entity == null) { _logger.LogInformation($"Game ID {userId} not found to delete! : Returning."); return; } _dbContext.Remove(entity); Save(); }