#152 routage recherche mis a jour et géré dans RouteConfiguration.cs

This commit is contained in:
b.nodon
2026-03-31 16:38:40 +02:00
parent 082e3cdf4c
commit 91d50717cd
2 changed files with 9 additions and 3 deletions

View File

@@ -10,7 +10,6 @@ namespace Webzine.WebApplication.Controllers
using Webzine.WebApplication.ViewModels.Recherche; using Webzine.WebApplication.ViewModels.Recherche;
using Webzine.WebApplication.ViewModels.Titre; using Webzine.WebApplication.ViewModels.Titre;
[Route("recherche")]
public class RechercheController : Controller public class RechercheController : Controller
{ {
private readonly ILogger<RechercheController> logger; private readonly ILogger<RechercheController> logger;
@@ -22,7 +21,7 @@ namespace Webzine.WebApplication.Controllers
this.titreRepository = titreRepository; this.titreRepository = titreRepository;
} }
[HttpPost("")] [HttpPost]
public IActionResult Index(string mot) public IActionResult Index(string mot)
{ {
this.logger.LogInformation("Recherche artistes/titres pour le mot : {Mot}.", mot); this.logger.LogInformation("Recherche artistes/titres pour le mot : {Mot}.", mot);

View File

@@ -8,10 +8,17 @@ public static class RouteConfiguration
public static void MapCustomRoutes(this IEndpointRouteBuilder endpoints) 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 ----------- // ----------- ARTISTE -----------
// exemple : /artiste/boblechanteurtarpingénial // exemple : /artiste/boblechanteurtarpingénial
endpoints.MapControllerRoute( endpoints.MapControllerRoute(
name: "TitreDetails", name: "ArtisteIndex",
pattern: "artiste/{nom}", pattern: "artiste/{nom}",
defaults: new { controller = "Artiste", action = "Index" }); defaults: new { controller = "Artiste", action = "Index" });