From 91d50717cd2fa85f5e330dd71e0dd23dc1393695 Mon Sep 17 00:00:00 2001 From: "b.nodon" Date: Tue, 31 Mar 2026 16:38:40 +0200 Subject: [PATCH] =?UTF-8?q?#152=20routage=20recherche=20mis=20a=20jour=20e?= =?UTF-8?q?t=20g=C3=A9r=C3=A9=20dans=20RouteConfiguration.cs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/RechercheController.cs | 3 +-- Webzine.WebApplication/Extensions/RouteConfiguration.cs | 9 ++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Webzine.WebApplication/Controllers/RechercheController.cs b/Webzine.WebApplication/Controllers/RechercheController.cs index 9d6f7e2..9b52e9b 100644 --- a/Webzine.WebApplication/Controllers/RechercheController.cs +++ b/Webzine.WebApplication/Controllers/RechercheController.cs @@ -10,7 +10,6 @@ namespace Webzine.WebApplication.Controllers using Webzine.WebApplication.ViewModels.Recherche; using Webzine.WebApplication.ViewModels.Titre; - [Route("recherche")] public class RechercheController : Controller { private readonly ILogger logger; @@ -22,7 +21,7 @@ namespace Webzine.WebApplication.Controllers this.titreRepository = titreRepository; } - [HttpPost("")] + [HttpPost] public IActionResult Index(string mot) { this.logger.LogInformation("Recherche artistes/titres pour le mot : {Mot}.", mot); diff --git a/Webzine.WebApplication/Extensions/RouteConfiguration.cs b/Webzine.WebApplication/Extensions/RouteConfiguration.cs index 82fad45..f316a9d 100644 --- a/Webzine.WebApplication/Extensions/RouteConfiguration.cs +++ b/Webzine.WebApplication/Extensions/RouteConfiguration.cs @@ -8,10 +8,17 @@ public static class RouteConfiguration public static void MapCustomRoutes(this IEndpointRouteBuilder endpoints) { + // ----------- RECHERCHE ----------- + // exemple : /artiste/boblechanteurtarpingénial + endpoints.MapControllerRoute( + name: "rechercheIndex", + pattern: "recherche", + defaults: new { controller = "Recherche", action = "Index" }); + // ----------- ARTISTE ----------- // exemple : /artiste/boblechanteurtarpingénial endpoints.MapControllerRoute( - name: "TitreDetails", + name: "ArtisteIndex", pattern: "artiste/{nom}", defaults: new { controller = "Artiste", action = "Index" });