# 123 fix 1

This commit is contained in:
b.nodon
2026-03-27 11:22:52 +01:00
parent a3db0059ab
commit b53fa189a5
3 changed files with 15 additions and 21 deletions

View File

@@ -31,12 +31,7 @@ public class DbCommentaireRepository : ICommentaireRepository
{
try
{
if (commentaire == null)
{
throw new ArgumentNullException(nameof(commentaire), "Le commentaire à ajouter ne peut pas être null.");
}
this.logger.LogInformation("Ajout d'un nouveau commentaire de l'auteur : {Auteur}", commentaire.Auteur);
this.logger.LogDebug("Ajout d'un nouveau commentaire de l'auteur : {Auteur}", commentaire.Auteur);
this.context.Commentaires.Add(commentaire);
this.context.SaveChanges();
this.logger.LogDebug("Commentaire ajouté avec l'id : {Id}", commentaire.IdCommentaire);
@@ -65,7 +60,7 @@ public class DbCommentaireRepository : ICommentaireRepository
this.context.Commentaires.Remove(commentaire);
this.context.SaveChanges();
this.logger.LogInformation("Le commentaire {IdCommentaire} a bien été supprimé", commentaire.IdCommentaire);
this.logger.LogDebug("Le commentaire {IdCommentaire} a bien été supprimé", commentaire.IdCommentaire);
}
catch (DbUpdateException dbex)
{
@@ -131,7 +126,7 @@ public class DbCommentaireRepository : ICommentaireRepository
/// <inheritdoc/>
public IEnumerable<Commentaire> FindByIdTitre(int idTitre)
{
this.logger.LogInformation("Recherche des commentaires pour le titre ID : {IdTitre}", idTitre);
this.logger.LogDebug("Recherche des commentaires pour le titre ID : {IdTitre}", idTitre);
var commentaires = this.context.Commentaires
.Where(c => c.Titre.IdTitre == idTitre)