/// <summary> Adds a new notice to the database. /// <param name="inputNotice"> object L_Notice (name of object) - This is a logic object of type notice. </param> /// <returns> void </returns> /// </summary> public void AddNotice(L_Notice inputNotice) { if (inputNotice.NoticeId != 0) { _logger.LogWarning($"Notice to be added has an ID ({inputNotice.NoticeId}) already!"); throw new ArgumentException("Id already exists when trying to add a new notice!", $"{inputNotice.NoticeId}"); } _logger.LogInformation("Adding notice."); D_Notice entity = Mapper.UnMapNotice(inputNotice); entity.NoticeId = 0; _dbContext.Add(entity); Save(); }
/// <summary> Adds a new game data to the database. /// <param name="inputScore"> object L_Score (name of object) - This is a logic object of type score. </param> /// <returns> void </returns> /// </summary> public void AddScore(L_Score inputScore) { if (inputScore.ScoreId != 0) { _logger.LogWarning($"Score to be added has an ID ({inputScore.ScoreId}) already!"); throw new ArgumentException("Id already exists when trying to add a new score!", $"{inputScore.ScoreId}"); } _logger.LogInformation("Adding game."); D_Score entity = Mapper.UnMapScore(inputScore); entity.ScoreId = 0; _dbContext.Add(entity); Save(); }
/// <summary> Adds a new review to the database. /// <param name="inputReview"> object L_Review (name of object) - This is a logic object of type review. </param> /// <returns> void </returns> /// </summary> public void AddReview(L_Review inputReview) { if (inputReview.ReviewId != 0) { _logger.LogWarning($"Review to be added has an ID ({inputReview.ReviewId}) already!"); throw new ArgumentException("Id already exists when trying to add a new game!", $"{inputReview.ReviewId}"); } _logger.LogInformation("Adding review."); D_Review entity = Mapper.UnMapReview(inputReview); entity.ReviewId = 0; _dbContext.Add(entity); Save(); }
/// <summary> Adds a new user to the database. /// <param name="inputUser"> object L_User (name of object) - This is a logic object of type user. </param> /// <returns> void </returns> /// </summary> public void AddUser(L_User inputUser) { if (inputUser.UserId != 0) { _logger.LogWarning($"User to be added has an ID ({inputUser.UserId}) already!"); throw new ArgumentException("Id already exists when trying to add a new user!", $"{inputUser.UserId}"); } _logger.LogInformation("Adding user."); D_User entity = Mapper.UnMapUser(inputUser); entity.UserId = 0; _dbContext.Add(entity); Save(); }
/// <summary> Adds a new game data to the database. /// <param name="inputGameData"> object L_GameData (name of object) - This is a logic object of type game data. </param> /// <returns> void </returns> /// </summary> public void AddGameData(L_GameData inputGameData) { if (inputGameData.DataId != 0) { _logger.LogWarning($"Game data to be added has an ID ({inputGameData.DataId}) already!"); throw new ArgumentException("Id already exists when trying to add a new game data!", $"{inputGameData.DataId}"); } _logger.LogInformation("Adding game data."); D_GameData entity = Mapper.UnMapGameData(inputGameData); entity.DataId = 0; _dbContext.Add(entity); Save(); }