Merge branch 'J1/admin/commentaire' into J1/feat/AdminTitreIHM

# Conflicts:
#	Webzine.WebApplication/Webzine.WebApplication.csproj
This commit is contained in:
mirage
2026-03-05 15:39:46 +01:00
9 changed files with 154 additions and 19 deletions

View File

@@ -0,0 +1,90 @@
@using Webzine.WebApplication.ViewModels
@using Webzine.Entity
@model CommentaireViewModel
@{
ViewData["Title"] = "Commentaires";
Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
<style>
.commentaires-container {
overflow-x: auto;
}
.commentaires-table {
width: 100%;
border-collapse: collapse;
margin-top: 1.5rem;
background: white;
}
.commentaires-table thead {
background: #ddd;
font-weight: bold;
}
.commentaires-table th, .commentaires-table td {
padding: 1rem;
border: 1px solid #ccc;
text-align: left;
}
.btn-delete {
color: #0066cc;
border: none;
background: none;
cursor: pointer;
font-size: 1.2rem;
}
.btn-delete:hover {
color: #ff4444;
}
</style>
<h1>Commentaires</h1>
<div class="commentaires-container">
<table class="commentaires-table">
<thead>
<tr>
<th>Titre</th>
<th>Auteur</th>
<th>Commentaire</th>
<th>Date de création</th>
<th style="text-align: center;">Actions</th>
</tr>
</thead>
<tbody>
@foreach (Webzine.Entity.Commentaire commentaire in Model.Commentaires)
{
<tr>
<td>
<!-- Titre est un objet, on affiche sa propriété Libelle -->
@(commentaire.Titre != null ? commentaire.Titre.Libelle : "Titre inconnu")
</td>
<td>
<!-- On utilise Auteur (et pas Nom) -->
@commentaire.Auteur
</td>
<td>
@commentaire.Contenu
</td>
<td>
@commentaire.DateCreation.ToString("dd/MM/yyyy HH:mm:ss")
</td>
<td style="text-align: center;">
<!-- On utilise IdCommentaire (et pas Id) -->
<form method="post" action="@Url.Action("Delete", new { id = commentaire.IdCommentaire })" style="display: inline;">
@Html.AntiForgeryToken()
<button type="submit" class="btn-delete" title="Supprimer">
<i class="fas fa-trash"></i>
</button>
</form>
</td>
</tr>
}
</tbody>
</table>
</div>

View File

@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>@ViewData["Title"] - Webzine</title>
@* Ajout de bootstrap *@
<script src="/js/bootstrap.min.js" defer></script>
<link rel="stylesheet" href="/css/app.css">
<link rel="stylesheet" href="/css/bootstrap.min.css">
@* Ajout de font-awesome *@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
</head>
<body>
<div class="container">
@await Html.PartialAsync("_Header")
<div class="row mt-5">
<main class="col-9">
@RenderBody()
</main>
@await Html.PartialAsync("_Sidebar")
</div>
</div>
</body>
</html>