diff --git a/Webzine.WebApplication/Controllers/TitreController.cs b/Webzine.WebApplication/Controllers/TitreController.cs index 76ad52b..ff13042 100644 --- a/Webzine.WebApplication/Controllers/TitreController.cs +++ b/Webzine.WebApplication/Controllers/TitreController.cs @@ -15,7 +15,6 @@ namespace Webzine.WebApplication.Controllers /// affichage des details, filtrage par style, /// ajout de likes, commentaires et recherche. /// - [Route("titre")] public class TitreController : Controller { private readonly ILogger logger; @@ -40,7 +39,6 @@ namespace Webzine.WebApplication.Controllers /// /// Identifiant du titre. /// Vue des details ou 404 si introuvable. - [HttpGet("{id}")] public IActionResult Details(int id) { this.logger.LogInformation("Demande d'affichage du detail pour le titre ID {Id}.", id); @@ -82,7 +80,6 @@ namespace Webzine.WebApplication.Controllers /// /// Nom du style musical. /// Vue contenant la liste filtree. - [HttpGet("style/{style}")] public IActionResult Style(string style) { this.logger.LogInformation("Recherche des titres pour le style : {Style}.", style); @@ -103,7 +100,7 @@ namespace Webzine.WebApplication.Controllers /// /// Modele contenant l'identifiant du titre. /// Redirection vers la page detail. - [HttpPost("like")] + [HttpPost] public IActionResult Like(TitreLike model) { this.logger.LogInformation("Ajout d'un like pour le titre ID {Id}.", model.IdTitre); @@ -126,7 +123,7 @@ namespace Webzine.WebApplication.Controllers /// /// Donnees du commentaire. /// Redirection vers la page detail. - [HttpPost("comment")] + [HttpPost] public IActionResult Comment(TitreComment model) { if (!this.ModelState.IsValid) diff --git a/Webzine.WebApplication/Extensions/RouteConfiguration.cs b/Webzine.WebApplication/Extensions/RouteConfiguration.cs index c1d9953..ac82502 100644 --- a/Webzine.WebApplication/Extensions/RouteConfiguration.cs +++ b/Webzine.WebApplication/Extensions/RouteConfiguration.cs @@ -7,26 +7,55 @@ public static class RouteConfiguration /// public static void MapCustomRoutes(this IEndpointRouteBuilder endpoints) { - // --- ARTISTES --- + + // --- DETAILS D'UN TITRE --- + // exemple : /titre/5 + endpoints.MapControllerRoute( + name: "TitreDetails", + pattern: "titre/{id}", + defaults: new { controller = "Titre", action = "Details" }); + + // --- TITRES PAR STYLE --- + // exemple : /titre/style/Rock + endpoints.MapControllerRoute( + name: "TitresParStyle", + 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 ----------- + + // ARTISTES endpoints.MapControllerRoute( name: "AdminArtistesIndex", pattern: "administration/artistes", defaults: new { area = "Administration", controller = "Artiste", action = "Index" }); - // --- COMMENTAIRES --- + // COMMENTAIRES endpoints.MapControllerRoute( name: "AdminCommentairesIndex", pattern: "administration/commentaires", defaults: new { area = "Administration", controller = "Commentaire", action = "Index" }); - // --- STYLES --- + // STYLES endpoints.MapControllerRoute( name: "AdminStylesIndex", pattern: "administration/styles", defaults: new { area = "Administration", controller = "Style", action = "Index" }); - - // --- TITRES --- + // TITRES endpoints.MapControllerRoute( name: "AdminTitresIndex", pattern: "administration/titres",