From cceff9a02d39c5fe7990172ae947ded0d96291be Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Wed, 25 Mar 2026 15:14:14 +0100 Subject: [PATCH] =?UTF-8?q?refactor:=20standardiser=20la=20journalisation?= =?UTF-8?q?=20des=20contr=C3=B4leurs=20et=20l=E2=80=99utilisation=20des=20?= =?UTF-8?q?r=C3=A9f=C3=A9rentiels?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IArtisteRepository.cs | 12 +-- .../ICommentaireRepository.cs | 10 +-- .../IStyleRepository.cs | 2 - .../ITtitreRepository.cs | 2 +- Webzine.Repository/DbTitreRepository.cs | 13 +-- .../Controllers/CommentaireController.cs | 1 + .../Controllers/DashboardController.cs | 67 +++++++------- .../Controllers/StyleController.cs | 88 ++++++++----------- .../Controllers/TitreController.cs | 76 ++++++++-------- .../ViewModels/Styles/StyleViewModel.cs | 17 ---- .../Administration/Views/Style/Index.cshtml | 8 +- .../Controllers/AccueilController.cs | 10 ++- .../Controllers/ApiController.cs | 20 ++--- .../Controllers/ArtisteController.cs | 24 ++--- .../Controllers/ContactController.cs | 10 +-- .../Controllers/RechercheController.cs | 40 ++++++--- .../Controllers/TitreController.cs | 36 ++++---- Webzine.WebApplication/Program.cs | 30 ++++--- 18 files changed, 214 insertions(+), 252 deletions(-) delete mode 100644 Webzine.WebApplication/Areas/Administration/ViewModels/Styles/StyleViewModel.cs diff --git a/Webzine.Repository.Contracts/IArtisteRepository.cs b/Webzine.Repository.Contracts/IArtisteRepository.cs index 1e4a369..2f112fc 100644 --- a/Webzine.Repository.Contracts/IArtisteRepository.cs +++ b/Webzine.Repository.Contracts/IArtisteRepository.cs @@ -1,17 +1,17 @@ -// using Webzine.Entity; +using Webzine.Entity; namespace Webzine.Repository.Contracts { public interface IArtisteRepository { - // void Add(Artiste artiste); + void Add(Artiste artiste); - // void Delete(Artiste artiste); + void Delete(Artiste artiste); - // Artiste Find(int id); + Artiste Find(int id); - // IEnumerable FindAll(); + IEnumerable FindAll(); - // void Update(Artiste artiste); + void Update(Artiste artiste); } } \ No newline at end of file diff --git a/Webzine.Repository.Contracts/ICommentaireRepository.cs b/Webzine.Repository.Contracts/ICommentaireRepository.cs index f1608b2..04fd1dd 100644 --- a/Webzine.Repository.Contracts/ICommentaireRepository.cs +++ b/Webzine.Repository.Contracts/ICommentaireRepository.cs @@ -1,15 +1,15 @@ -// using Webzine.Entity; +using Webzine.Entity; namespace Webzine.Repository.Contracts { public interface ICommentaireRepository { - // void Add(Commentaire commentaire); + void Add(Commentaire commentaire); - // void Delete(Commentaire commentaire); + void Delete(Commentaire commentaire); - // Commentaire Find(int id); + Commentaire Find(int id); - // IEnumerable FindAll(); + IEnumerable FindAll(); } } \ No newline at end of file diff --git a/Webzine.Repository.Contracts/IStyleRepository.cs b/Webzine.Repository.Contracts/IStyleRepository.cs index 6cc0e0b..ba078d9 100644 --- a/Webzine.Repository.Contracts/IStyleRepository.cs +++ b/Webzine.Repository.Contracts/IStyleRepository.cs @@ -1,5 +1,3 @@ -// using Webzine.Entity; - using Webzine.Entity; namespace Webzine.Repository.Contracts diff --git a/Webzine.Repository.Contracts/ITtitreRepository.cs b/Webzine.Repository.Contracts/ITtitreRepository.cs index 4dcd430..0031caa 100644 --- a/Webzine.Repository.Contracts/ITtitreRepository.cs +++ b/Webzine.Repository.Contracts/ITtitreRepository.cs @@ -10,7 +10,7 @@ namespace Webzine.Repository.Contracts void Delete(Titre titre); - Titre? Find(int idTitre); + Titre Find(int idTitre); IEnumerable FindTitres(int offset, int limit); diff --git a/Webzine.Repository/DbTitreRepository.cs b/Webzine.Repository/DbTitreRepository.cs index 54be151..221307e 100644 --- a/Webzine.Repository/DbTitreRepository.cs +++ b/Webzine.Repository/DbTitreRepository.cs @@ -180,7 +180,7 @@ public class DbTitreRepository : ITitreRepository /// /// L'identifiant du titre à trouver. /// Le titre correspondant à l'identifiant fourni, ou null si aucun titre n'est trouvé. - public Titre? Find(int idTitre) + public Titre Find(int idTitre) { this.logger.LogDebug($"Finding titre with Id: {idTitre}"); @@ -188,16 +188,7 @@ public class DbTitreRepository : ITitreRepository .Include(t => t.Artiste) .Include(t => t.Styles) .Include(t => t.Commentaires) - .FirstOrDefault(t => t.IdTitre == idTitre); - - if (titre == null) - { - this.logger.LogWarning($"Titre with Id {idTitre} not found"); - } - else - { - this.logger.LogDebug($"Found titre: {titre.Libelle}"); - } + .First(t => t.IdTitre == idTitre); return titre; } diff --git a/Webzine.WebApplication/Areas/Administration/Controllers/CommentaireController.cs b/Webzine.WebApplication/Areas/Administration/Controllers/CommentaireController.cs index 1342459..236bfb7 100644 --- a/Webzine.WebApplication/Areas/Administration/Controllers/CommentaireController.cs +++ b/Webzine.WebApplication/Areas/Administration/Controllers/CommentaireController.cs @@ -12,6 +12,7 @@ namespace Webzine.WebApplication.Areas.Administration.Controllers private readonly List _commentaires; /// + /// Initialise une nouvelle instance de la classe . /// Initialise une nouvelle instance du . /// Les données sont générées dynamiquement via . /// diff --git a/Webzine.WebApplication/Areas/Administration/Controllers/DashboardController.cs b/Webzine.WebApplication/Areas/Administration/Controllers/DashboardController.cs index a2ac740..7ef5253 100644 --- a/Webzine.WebApplication/Areas/Administration/Controllers/DashboardController.cs +++ b/Webzine.WebApplication/Areas/Administration/Controllers/DashboardController.cs @@ -1,6 +1,8 @@ +using System.Diagnostics; using Microsoft.AspNetCore.Mvc; using Webzine.Entity; using Webzine.Entity.Fixtures; +using Webzine.Repository.Contracts; using Webzine.WebApplication.Areas.Administration.ViewModels; namespace Webzine.WebApplication.Areas.Administration.Controllers; @@ -8,31 +10,24 @@ namespace Webzine.WebApplication.Areas.Administration.Controllers; [Area("Administration")] public class DashboardController : Controller { - private readonly ILogger _logger; - private readonly List _titres; - private readonly List