refactor: mise à jour des routes et actions Titre pour utiliser l’index au lieu des détails

This commit is contained in:
mirage
2026-04-01 14:46:47 +02:00
parent b5b21a6735
commit e30705dbe4
8 changed files with 13 additions and 49 deletions

View File

@@ -7,54 +7,18 @@ public static class RouteConfiguration
/// </summary>
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<string, string>
{
{ "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?}");
}
}
}