From e30705dbe47b13940de4b3db304f79ddaf81064d Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Wed, 1 Apr 2026 14:46:47 +0200 Subject: [PATCH] =?UTF-8?q?refactor:=20mise=20=C3=A0=20jour=20des=20routes?= =?UTF-8?q?=20et=20actions=20Titre=20pour=20utiliser=20l=E2=80=99index=20a?= =?UTF-8?q?u=20lieu=20des=20d=C3=A9tails?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/Commentaire/Index.cshtml | 2 +- .../Views/Dashboard/Index.cshtml | 2 +- .../Controllers/TitreController.cs | 3 +- .../Extensions/RouteConfiguration.cs | 43 ++----------------- .../Views/Accueil/Index.cshtml | 6 +-- .../Views/Artiste/Index.cshtml | 2 +- .../Views/Recherche/Index.cshtml | 4 +- .../Titre/{Details.cshtml => Index.cshtml} | 0 8 files changed, 13 insertions(+), 49 deletions(-) rename Webzine.WebApplication/Views/Titre/{Details.cshtml => Index.cshtml} (100%) diff --git a/Webzine.WebApplication/Areas/Administration/Views/Commentaire/Index.cshtml b/Webzine.WebApplication/Areas/Administration/Views/Commentaire/Index.cshtml index c8608b7..1c8a9db 100644 --- a/Webzine.WebApplication/Areas/Administration/Views/Commentaire/Index.cshtml +++ b/Webzine.WebApplication/Areas/Administration/Views/Commentaire/Index.cshtml @@ -25,7 +25,7 @@ { - + @commentaire.Titre.Libelle diff --git a/Webzine.WebApplication/Areas/Administration/Views/Dashboard/Index.cshtml b/Webzine.WebApplication/Areas/Administration/Views/Dashboard/Index.cshtml index ac676f2..3f69891 100644 --- a/Webzine.WebApplication/Areas/Administration/Views/Dashboard/Index.cshtml +++ b/Webzine.WebApplication/Areas/Administration/Views/Dashboard/Index.cshtml @@ -94,7 +94,7 @@
diff --git a/Webzine.WebApplication/Controllers/TitreController.cs b/Webzine.WebApplication/Controllers/TitreController.cs index ff13042..63960cf 100644 --- a/Webzine.WebApplication/Controllers/TitreController.cs +++ b/Webzine.WebApplication/Controllers/TitreController.cs @@ -39,7 +39,8 @@ namespace Webzine.WebApplication.Controllers /// /// Identifiant du titre. /// Vue des details ou 404 si introuvable. - public IActionResult Details(int id) + + public IActionResult Index(int id) { this.logger.LogInformation("Demande d'affichage du detail pour le titre ID {Id}.", id); diff --git a/Webzine.WebApplication/Extensions/RouteConfiguration.cs b/Webzine.WebApplication/Extensions/RouteConfiguration.cs index 8cf015d..fd5f16c 100644 --- a/Webzine.WebApplication/Extensions/RouteConfiguration.cs +++ b/Webzine.WebApplication/Extensions/RouteConfiguration.cs @@ -7,54 +7,18 @@ public static class RouteConfiguration /// public static void MapCustomRoutes(this IEndpointRouteBuilder endpoints) { - - // ----------- RECHERCHE ----------- - endpoints.MapControllerRoute( - name: "rechercheIndex", - pattern: "recherche", - defaults: new { controller = "Recherche", action = "Index" }); - - // ----------- ARTISTE ----------- - // exemple : /artiste/boblechanteurtarpingénial - endpoints.MapControllerRoute( - name: "ArtisteIndex", - pattern: "artiste/{nom}", - defaults: new { controller = "Artiste", action = "Index" }); - // ----------- TITRE ----------- - // exemple : /titre/5 endpoints.MapControllerRoute( - name: "TitreDetails", - pattern: "titre/{id}", - defaults: new { controller = "Titre", action = "Details" }); - - // exemple : /titre/style/Rock - endpoints.MapControllerRoute( - name: "TitresParStyle", + name: "TitreStyle", pattern: "titres/style/{style}", defaults: new { controller = "Titre", action = "Style" }); - // --- ACTIONS POST (LIKE / COMMENT) --- - endpoints.MapControllerRoute( - name: "TitreLike", - pattern: "titre/like", - defaults: new { controller = "Titre", action = "Like" }); - - endpoints.MapControllerRoute( - name: "TitreComment", - pattern: "titre/comment", - defaults: new { controller = "Titre", action = "Comment" }); - - // ----------- ADMIN ----------- var adminRoutes = new Dictionary { - { "artistes", "Artiste" }, - { "commentaires", "Commentaire" }, - { "styles", "Style" }, - { "titres", "Titre" } + { "artistes", "Artiste" }, { "commentaires", "Commentaire" }, { "styles", "Style" }, { "titres", "Titre" }, }; foreach (var route in adminRoutes) @@ -66,7 +30,6 @@ public static class RouteConfiguration } - // --- AUTRE PROUTES --- endpoints.MapControllerRoute( @@ -77,4 +40,4 @@ public static class RouteConfiguration name: "default", pattern: "{controller=Accueil}/{action=Index}/{id?}"); } -} +} \ No newline at end of file diff --git a/Webzine.WebApplication/Views/Accueil/Index.cshtml b/Webzine.WebApplication/Views/Accueil/Index.cshtml index 6b11176..defe1e8 100644 --- a/Webzine.WebApplication/Views/Accueil/Index.cshtml +++ b/Webzine.WebApplication/Views/Accueil/Index.cshtml @@ -29,7 +29,7 @@ @titre.Artiste.Nom - - @titre.Libelle @@ -43,7 +43,7 @@
- @@ -90,7 +90,7 @@ @titre.Album
- + @titre.Libelle
diff --git a/Webzine.WebApplication/Views/Artiste/Index.cshtml b/Webzine.WebApplication/Views/Artiste/Index.cshtml index 59716b8..fe66f72 100644 --- a/Webzine.WebApplication/Views/Artiste/Index.cshtml +++ b/Webzine.WebApplication/Views/Artiste/Index.cshtml @@ -56,7 +56,7 @@ else @dureeFormatee @titre.Libelle diff --git a/Webzine.WebApplication/Views/Recherche/Index.cshtml b/Webzine.WebApplication/Views/Recherche/Index.cshtml index cb5fca6..5eec91c 100644 --- a/Webzine.WebApplication/Views/Recherche/Index.cshtml +++ b/Webzine.WebApplication/Views/Recherche/Index.cshtml @@ -50,7 +50,7 @@ {
@titre.Libelle @@ -65,7 +65,7 @@ - @titre.Libelle diff --git a/Webzine.WebApplication/Views/Titre/Details.cshtml b/Webzine.WebApplication/Views/Titre/Index.cshtml similarity index 100% rename from Webzine.WebApplication/Views/Titre/Details.cshtml rename to Webzine.WebApplication/Views/Titre/Index.cshtml