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">
|
<tr class="align-middle">
|
||||||
<td>
|
<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
|
@commentaire.Titre.Libelle
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -94,7 +94,7 @@
|
|||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<a asp-area=""
|
<a asp-area=""
|
||||||
asp-controller="Titre"
|
asp-controller="Titre"
|
||||||
asp-action="Details"
|
asp-action="Index"
|
||||||
asp-route-id="@Model.IdMusiqueLaPlusJouee">
|
asp-route-id="@Model.IdMusiqueLaPlusJouee">
|
||||||
<div class="ratio ratio-4x3">
|
<div class="ratio ratio-4x3">
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ namespace Webzine.WebApplication.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">Identifiant du titre.</param>
|
/// <param name="id">Identifiant du titre.</param>
|
||||||
/// <returns>Vue des details ou 404 si introuvable.</returns>
|
/// <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);
|
this.logger.LogInformation("Demande d'affichage du detail pour le titre ID {Id}.", id);
|
||||||
|
|
||||||
|
|||||||
@@ -7,54 +7,18 @@ public static class RouteConfiguration
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void MapCustomRoutes(this IEndpointRouteBuilder endpoints)
|
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 -----------
|
// ----------- TITRE -----------
|
||||||
// exemple : /titre/5
|
|
||||||
endpoints.MapControllerRoute(
|
endpoints.MapControllerRoute(
|
||||||
name: "TitreDetails",
|
name: "TitreStyle",
|
||||||
pattern: "titre/{id}",
|
|
||||||
defaults: new { controller = "Titre", action = "Details" });
|
|
||||||
|
|
||||||
// exemple : /titre/style/Rock
|
|
||||||
endpoints.MapControllerRoute(
|
|
||||||
name: "TitresParStyle",
|
|
||||||
pattern: "titres/style/{style}",
|
pattern: "titres/style/{style}",
|
||||||
defaults: new { controller = "Titre", action = "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 -----------
|
// ----------- ADMIN -----------
|
||||||
|
|
||||||
var adminRoutes = new Dictionary<string, string>
|
var adminRoutes = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
{ "artistes", "Artiste" },
|
{ "artistes", "Artiste" }, { "commentaires", "Commentaire" }, { "styles", "Style" }, { "titres", "Titre" },
|
||||||
{ "commentaires", "Commentaire" },
|
|
||||||
{ "styles", "Style" },
|
|
||||||
{ "titres", "Titre" }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var route in adminRoutes)
|
foreach (var route in adminRoutes)
|
||||||
@@ -66,7 +30,6 @@ public static class RouteConfiguration
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// --- AUTRE PROUTES ---
|
// --- AUTRE PROUTES ---
|
||||||
|
|
||||||
endpoints.MapControllerRoute(
|
endpoints.MapControllerRoute(
|
||||||
@@ -77,4 +40,4 @@ public static class RouteConfiguration
|
|||||||
name: "default",
|
name: "default",
|
||||||
pattern: "{controller=Accueil}/{action=Index}/{id?}");
|
pattern: "{controller=Accueil}/{action=Index}/{id?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
@titre.Artiste.Nom
|
@titre.Artiste.Nom
|
||||||
</a>
|
</a>
|
||||||
-
|
-
|
||||||
<a asp-action="Details"
|
<a asp-action="Index"
|
||||||
asp-controller="Titre"
|
asp-controller="Titre"
|
||||||
asp-route-id="@titre.IdTitre">
|
asp-route-id="@titre.IdTitre">
|
||||||
@titre.Libelle
|
@titre.Libelle
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
<!-- Footer -->
|
<!-- Footer -->
|
||||||
<div class="d-flex flex-wrap align-items-center gap-3">
|
<div class="d-flex flex-wrap align-items-center gap-3">
|
||||||
<a asp-action="Details"
|
<a asp-action="Index"
|
||||||
asp-controller="Titre"
|
asp-controller="Titre"
|
||||||
asp-route-id="@titre.IdTitre"
|
asp-route-id="@titre.IdTitre"
|
||||||
class="btn btn-primary btn-sm">
|
class="btn btn-primary btn-sm">
|
||||||
@@ -90,7 +90,7 @@
|
|||||||
<img class="card-img-top" src="@titre.UrlJaquette" alt="@titre.Album" loading="lazy" />
|
<img class="card-img-top" src="@titre.UrlJaquette" alt="@titre.Album" loading="lazy" />
|
||||||
|
|
||||||
<div class="card-body">
|
<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
|
@titre.Libelle
|
||||||
</a>
|
</a>
|
||||||
<br />
|
<br />
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ else
|
|||||||
<td class="text-secondary font-monospace">@dureeFormatee</td>
|
<td class="text-secondary font-monospace">@dureeFormatee</td>
|
||||||
<td>
|
<td>
|
||||||
<a asp-controller="Titre"
|
<a asp-controller="Titre"
|
||||||
asp-action="Details"
|
asp-action="Index"
|
||||||
asp-route-id="@titre.IdTitre"
|
asp-route-id="@titre.IdTitre"
|
||||||
class="text-primary">
|
class="text-primary">
|
||||||
@titre.Libelle
|
@titre.Libelle
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
{
|
{
|
||||||
<div class="d-flex align-items-start my-3">
|
<div class="d-flex align-items-start my-3">
|
||||||
<a asp-controller="Titre"
|
<a asp-controller="Titre"
|
||||||
asp-action="Details"
|
asp-action="Index"
|
||||||
asp-route-id="@titre.IdTitre"
|
asp-route-id="@titre.IdTitre"
|
||||||
class="me-3 text-black">
|
class="me-3 text-black">
|
||||||
<img src="@titre.UrlJaquette" alt="@titre.Libelle" width="70" height="70" class="object-fit-cover" loading="lazy"/>
|
<img src="@titre.UrlJaquette" alt="@titre.Libelle" width="70" height="70" class="object-fit-cover" loading="lazy"/>
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
</a>
|
</a>
|
||||||
-
|
-
|
||||||
<a asp-controller="Titre"
|
<a asp-controller="Titre"
|
||||||
asp-action="Details"
|
asp-action="Index"
|
||||||
asp-route-id="@titre.IdTitre">
|
asp-route-id="@titre.IdTitre">
|
||||||
@titre.Libelle
|
@titre.Libelle
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user