refactor: mise à jour des routes et actions Titre pour utiliser l’index au lieu des détails
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
{
|
||||
<tr class="align-middle">
|
||||
<td>
|
||||
<a asp-action="Details" asp-controller="Titre" asp-route-id="@commentaire.Titre.IdTitre">
|
||||
<a asp-controller="Titre" asp-action="Index" asp-route-id="@commentaire.Titre.IdTitre">
|
||||
@commentaire.Titre.Libelle
|
||||
</a>
|
||||
</td>
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
<div class="col-md-4">
|
||||
<a asp-area=""
|
||||
asp-controller="Titre"
|
||||
asp-action="Details"
|
||||
asp-action="Index"
|
||||
asp-route-id="@Model.IdMusiqueLaPlusJouee">
|
||||
<div class="ratio ratio-4x3">
|
||||
|
||||
|
||||
@@ -39,7 +39,8 @@ namespace Webzine.WebApplication.Controllers
|
||||
/// </summary>
|
||||
/// <param name="id">Identifiant du titre.</param>
|
||||
/// <returns>Vue des details ou 404 si introuvable.</returns>
|
||||
public IActionResult Details(int id)
|
||||
|
||||
public IActionResult Index(int id)
|
||||
{
|
||||
this.logger.LogInformation("Demande d'affichage du detail pour le titre ID {Id}.", id);
|
||||
|
||||
|
||||
@@ -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?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@
|
||||
@titre.Artiste.Nom
|
||||
</a>
|
||||
-
|
||||
<a asp-action="Details"
|
||||
<a asp-action="Index"
|
||||
asp-controller="Titre"
|
||||
asp-route-id="@titre.IdTitre">
|
||||
@titre.Libelle
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
<!-- Footer -->
|
||||
<div class="d-flex flex-wrap align-items-center gap-3">
|
||||
<a asp-action="Details"
|
||||
<a asp-action="Index"
|
||||
asp-controller="Titre"
|
||||
asp-route-id="@titre.IdTitre"
|
||||
class="btn btn-primary btn-sm">
|
||||
@@ -90,7 +90,7 @@
|
||||
<img class="card-img-top" src="@titre.UrlJaquette" alt="@titre.Album" loading="lazy" />
|
||||
|
||||
<div class="card-body">
|
||||
<a asp-controller="Titre" asp-action="Details" asp-route-id="@titre.IdTitre" class="card-link">
|
||||
<a asp-controller="Titre" asp-action="Index" asp-route-id="@titre.IdTitre" class="card-link">
|
||||
@titre.Libelle
|
||||
</a>
|
||||
<br />
|
||||
|
||||
@@ -56,7 +56,7 @@ else
|
||||
<td class="text-secondary font-monospace">@dureeFormatee</td>
|
||||
<td>
|
||||
<a asp-controller="Titre"
|
||||
asp-action="Details"
|
||||
asp-action="Index"
|
||||
asp-route-id="@titre.IdTitre"
|
||||
class="text-primary">
|
||||
@titre.Libelle
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
{
|
||||
<div class="d-flex align-items-start my-3">
|
||||
<a asp-controller="Titre"
|
||||
asp-action="Details"
|
||||
asp-action="Index"
|
||||
asp-route-id="@titre.IdTitre"
|
||||
class="me-3 text-black">
|
||||
<img src="@titre.UrlJaquette" alt="@titre.Libelle" width="70" height="70" class="object-fit-cover" loading="lazy"/>
|
||||
@@ -65,7 +65,7 @@
|
||||
</a>
|
||||
-
|
||||
<a asp-controller="Titre"
|
||||
asp-action="Details"
|
||||
asp-action="Index"
|
||||
asp-route-id="@titre.IdTitre">
|
||||
@titre.Libelle
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user