#185 formulaire admin Artiste et style.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
using Webzine.Business.Contracts.Dto;
|
|
||||||
|
|
||||||
namespace Webzine.Business.Contracts;
|
namespace Webzine.Business.Contracts;
|
||||||
|
|
||||||
|
using Webzine.Business.Contracts.Dto;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Service responsable du calcul des statistiques affichées sur le tableau de bord d'administration.
|
/// Service responsable du calcul des statistiques affichées sur le tableau de bord d'administration.
|
||||||
/// Agrège les données provenant de plusieurs repositories pour produire un résumé cohérent.
|
/// Agrège les données provenant de plusieurs repositories pour produire un résumé cohérent.
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
using Webzine.Business.Contracts;
|
|
||||||
using Webzine.Entity;
|
|
||||||
using Webzine.Repository.Contracts;
|
|
||||||
|
|
||||||
namespace Webzine.Business;
|
namespace Webzine.Business;
|
||||||
|
|
||||||
using Contracts.Dto;
|
using Webzine.Business.Contracts;
|
||||||
|
using Webzine.Business.Contracts.Dto;
|
||||||
|
using Webzine.Entity;
|
||||||
|
using Webzine.Repository.Contracts;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Implémentation de <see cref="IDashboardService"/>.
|
/// Implémentation de <see cref="IDashboardService"/>.
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
namespace Webzine.WebApplication.Areas.Administration.Controllers;
|
namespace Webzine.WebApplication.Areas.Administration.Controllers;
|
||||||
|
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
using Webzine.Business.Contracts;
|
using Webzine.Business.Contracts;
|
||||||
using Webzine.Business.Contracts.Dto;
|
using Webzine.Business.Contracts.Dto;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Webzine.Repository.Contracts;
|
|
||||||
|
|
||||||
[Area("Administration")]
|
[Area("Administration")]
|
||||||
public class DashboardController : Controller
|
public class DashboardController : Controller
|
||||||
@@ -31,7 +31,7 @@ public class DashboardController : Controller
|
|||||||
/// <returns>La vue Index du tableau de bord.</returns>
|
/// <returns>La vue Index du tableau de bord.</returns>
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
{
|
{
|
||||||
DashboardDTO data = dashboardService.GetDashboardData();
|
DashboardDTO data = this.dashboardService.GetDashboardData();
|
||||||
|
|
||||||
return this.View(data);
|
return this.View(data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,12 +10,15 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Nom de l'artiste.
|
/// Nom de l'artiste.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
[Required(ErrorMessage = "Le nom de l'auteur est obligatoire.")]
|
||||||
|
[StringLength(50, ErrorMessage = "Le nom ne doit pas dépasser 50 caractères.")]
|
||||||
public string Nom { get; set; }
|
public string Nom { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Biographie de l'artiste.
|
/// Biographie de l'artiste.
|
||||||
/// </summary>
|
/// </summary>*
|
||||||
|
[Required(ErrorMessage = "La biographie ne peux pas etre vide.")]
|
||||||
|
|
||||||
public string Biographie { get; set; }
|
public string Biographie { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,12 +16,15 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Nom de l'artiste.
|
/// Nom de l'artiste.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
[Required(ErrorMessage = "Le nom de l'auteur est obligatoire.")]
|
||||||
|
[StringLength(50, ErrorMessage = "Le nom ne doit pas dépasser 50 caractères.")]
|
||||||
|
|
||||||
public string Nom { get; set; }
|
public string Nom { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Biographie de l'artiste.
|
/// Biographie de l'artiste.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Required(ErrorMessage = "Le contenu de la biographie ne peut pas être vide.")]
|
||||||
public string Biographie { get; set; }
|
public string Biographie { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,7 @@ namespace Webzine.WebApplication.Areas.Administration.ViewModels.Style
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Obtient ou définit le libellé du style.
|
/// Obtient ou définit le libellé du style.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
[Required(ErrorMessage = "Le libelle du style est obligatoire.")]
|
||||||
public string Libelle { get; set; }
|
public string Libelle { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,7 @@ namespace Webzine.WebApplication.Areas.Administration.ViewModels.Style
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Obtient ou definit le libelle du style.
|
/// Obtient ou definit le libelle du style.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
[Required(ErrorMessage = "Le libelle du style est obligatoire.")]
|
||||||
public string Libelle { get; set; }
|
public string Libelle { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,6 +11,8 @@
|
|||||||
<label class="col-md-3 col-form-label">Nom de l'artiste<span class="text-danger">*</span></label>
|
<label class="col-md-3 col-form-label">Nom de l'artiste<span class="text-danger">*</span></label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<input asp-for="Nom" class="form-control" />
|
<input asp-for="Nom" class="form-control" />
|
||||||
|
<span asp-validation-for="Nom" class="text-danger"></span>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -19,6 +21,8 @@
|
|||||||
<label class="col-md-3 col-form-label">Biographie</label>
|
<label class="col-md-3 col-form-label">Biographie</label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<textarea asp-for="Biographie" class="form-control" rows="5"></textarea>
|
<textarea asp-for="Biographie" class="form-control" rows="5"></textarea>
|
||||||
|
<span asp-validation-for="Biographie" class="text-danger"></span>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
<label class="col-md-3 col-form-label">Nom de l'artiste<span class="text-danger">*</span></label>
|
<label class="col-md-3 col-form-label">Nom de l'artiste<span class="text-danger">*</span></label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<input asp-for="Nom" class="form-control" />
|
<input asp-for="Nom" class="form-control" />
|
||||||
|
<span asp-validation-for="Nom" class="text-danger"></span>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -14,7 +16,10 @@
|
|||||||
<label class="col-md-3 col-form-label">Biographie</label>
|
<label class="col-md-3 col-form-label">Biographie</label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<textarea asp-for="Biographie" class="form-control" rows="5"></textarea>
|
<textarea asp-for="Biographie" class="form-control" rows="5"></textarea>
|
||||||
|
<span asp-validation-for="Biographie" class="text-danger"></span>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- BOUTONS -->
|
<!-- BOUTONS -->
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ 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 Index(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);
|
||||||
|
|||||||
@@ -23,9 +23,7 @@ public static class RouteConfiguration
|
|||||||
pattern: "artiste/{nom}",
|
pattern: "artiste/{nom}",
|
||||||
defaults: new { controller = "Artiste", action = "Index" });
|
defaults: new { controller = "Artiste", action = "Index" });
|
||||||
|
|
||||||
|
|
||||||
// ----------- ADMIN -----------
|
// ----------- ADMIN -----------
|
||||||
|
|
||||||
var adminRoutes = new Dictionary<string, string>
|
var adminRoutes = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
{ "artistes", "Artiste" }, { "commentaires", "Commentaire" }, { "styles", "Style" }, { "titres", "Titre" },
|
{ "artistes", "Artiste" }, { "commentaires", "Commentaire" }, { "styles", "Style" }, { "titres", "Titre" },
|
||||||
@@ -39,9 +37,7 @@ public static class RouteConfiguration
|
|||||||
defaults: new { area = "Administration", controller = route.Value, action = "Index" });
|
defaults: new { area = "Administration", controller = route.Value, action = "Index" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// --- AUTRE PROUTES ---
|
// --- AUTRE PROUTES ---
|
||||||
|
|
||||||
endpoints.MapControllerRoute(
|
endpoints.MapControllerRoute(
|
||||||
name: "areas",
|
name: "areas",
|
||||||
pattern: "{area:exists}/{controller=Home}/{action=Index}/{id?}");
|
pattern: "{area:exists}/{controller=Home}/{action=Index}/{id?}");
|
||||||
|
|||||||
Reference in New Issue
Block a user