feat: Ajouter la fonctionnalité de suppression de commentaires avec un nouveau ViewModel
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
@model Webzine.WebApplication.Areas.Administration.ViewModels.Commentaire.CommentaireDeleteViewModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Supprimer un commentaire";
|
||||
}
|
||||
|
||||
<div class="container mt-4">
|
||||
|
||||
<h1 class="mb-3">Supprimer un commentaire</h1>
|
||||
<hr />
|
||||
|
||||
<p class="mb-4">
|
||||
Êtes-vous sûr de vouloir supprimer le commentaire suivant ?
|
||||
</p>
|
||||
|
||||
<div class="mb-4">
|
||||
<h4>@Model.Contenu</h4>
|
||||
|
||||
<div class="text-muted">
|
||||
— <strong>@Model.Auteur</strong>
|
||||
le @Model.DateCreation.ToString("dd/MM/yyyy HH:mm:ss")
|
||||
sur <em>@Model.TitreLibelle</em>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form asp-action="Delete" method="post">
|
||||
<input type="hidden" asp-for="IdCommentaire" />
|
||||
|
||||
<button type="submit" class="btn btn-danger">
|
||||
Supprimer
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<a asp-action="Index"
|
||||
class="btn-link">
|
||||
Retour à l'administration des commentaires
|
||||
</a>
|
||||
|
||||
</div>
|
||||
@@ -1,4 +1,4 @@
|
||||
@model Webzine.WebApplication.Areas.Administration.ViewModels.CommentaireViewModel
|
||||
@model Webzine.WebApplication.Areas.Administration.ViewModels.Commentaire.CommentaireViewModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Commentaires";
|
||||
@@ -24,7 +24,7 @@
|
||||
{
|
||||
<tr class="align-middle">
|
||||
<td>
|
||||
@(commentaire.Titre != null ? commentaire.Titre.Libelle : "Titre inconnu")
|
||||
@commentaire.Titre.Libelle
|
||||
</td>
|
||||
<td>
|
||||
@commentaire.Auteur
|
||||
@@ -36,13 +36,9 @@
|
||||
@commentaire.DateCreation.ToString("dd/MM/yyyy HH:mm:ss")
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<form method="post" action="@Url.Action("Delete", new { id = commentaire.IdCommentaire })" class="d-inline">
|
||||
@Html.AntiForgeryToken()
|
||||
<!-- Bouton rouge (text-danger) sans fond (btn-link) -->
|
||||
<button type="submit" class="btn btn-link text-primary p-0" title="Supprimer" onclick="return confirm('Êtes-vous sûr de vouloir supprimer ce commentaire ?');">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</form>
|
||||
<a asp-action="Delete" asp-route-id="@commentaire.IdCommentaire" class="d-inline btn btn-link text-primary">
|
||||
<i class="fas fa-trash"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
Reference in New Issue
Block a user