#26 Modification des pages CRUD d'artiste admin en utilisant la DataFactory et un nouveau ViewModel pour les formulaires. Navigation entre les vues et le controlleur mise en place avec un id en parametres. Tri des artistes par ordre alphabetique déplacé dans le controlleur.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
@model Webzine.WebApplication.Areas.Administration.ViewModels.Artiste.AdminArtisteForm
|
||||
|
||||
<h1>Créer un artiste</h1>
|
||||
|
||||
<hr />
|
||||
|
||||
<form asp-action="Create" method="post">
|
||||
|
||||
<partial name="_Form" />
|
||||
|
||||
</form>
|
||||
@@ -0,0 +1,32 @@
|
||||
@model Webzine.WebApplication.Areas.Administration.ViewModels.Artiste.AdminArtisteForm
|
||||
|
||||
<div class="container mt-4">
|
||||
|
||||
<h1 class="mb-3">Supprimer un artiste</h1>
|
||||
|
||||
<hr />
|
||||
|
||||
<p>
|
||||
Etes-vous sûr de vouloir supprimer l'artiste
|
||||
"@Model.Nom" ?
|
||||
</p>
|
||||
|
||||
<form asp-action="Delete" method="post">
|
||||
|
||||
<input type="hidden" asp-for="Id" />
|
||||
|
||||
<button type="submit" class="btn btn-danger">
|
||||
Supprimer
|
||||
</button>
|
||||
|
||||
</form>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
|
||||
|
||||
<a asp-action="Index">
|
||||
Retour à l'administration des artistes
|
||||
</a>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,13 @@
|
||||
@model Webzine.WebApplication.Areas.Administration.ViewModels.Artiste.AdminArtisteForm
|
||||
|
||||
<h1>Editer un artiste</h1>
|
||||
|
||||
<hr />
|
||||
|
||||
<form asp-action="Edit" method="post">
|
||||
|
||||
<input type="hidden" asp-for="Id"/>
|
||||
|
||||
<partial name="_Form" />
|
||||
|
||||
</form>
|
||||
@@ -8,39 +8,34 @@
|
||||
<div class="container mt-4">
|
||||
<h1 class="mb-4">Artiste</h1>
|
||||
<hr />
|
||||
<a asp-action="" class="btn btn-primary mb-3">
|
||||
<i class="fa fa-plus"></i> Ajouter un nouvel titre
|
||||
<a asp-action="Create" class="btn btn-primary mb-3">
|
||||
<i class="fa fa-plus"></i> Ajouter un nouvel artiste
|
||||
</a>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover table-bordered">
|
||||
<table class="table table-striped table-hover table-bordered table-sm">
|
||||
<thead class="table-active">
|
||||
<tr>
|
||||
<th scope="col">Nom de l'artiste</th>
|
||||
<th scope="col" class="text-center">Actions</th>
|
||||
<th scope="col" class="p-2">Nom</th>
|
||||
<th scope="col" class="text-center p-2" style="width: 100px;">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@* On groupe les artistes par nom *@
|
||||
@{
|
||||
var artistes = Model.Artistes
|
||||
.OrderBy(t => t.Nom); // Trie les artistes par ordre alphabétique
|
||||
}
|
||||
|
||||
@foreach (var artiste in artistes)
|
||||
@foreach (var artiste in Model.Artistes)
|
||||
{
|
||||
<tr class="align-middle">
|
||||
<td class="col-10">
|
||||
<td class="p-2">
|
||||
@artiste.Nom
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<td class="text-center p-2">
|
||||
|
||||
<a asp-action="Edit" asp-route-id="@artiste.IdArtiste"
|
||||
class="btn btn-sm text-primary">
|
||||
<i class="fa fa-pen"></i>
|
||||
class="text-primary">
|
||||
<i class="fa fa-edit"></i>
|
||||
</a>
|
||||
|
||||
<a asp-action="Delete" asp-route-id="@artiste.IdArtiste"
|
||||
class="btn btn-sm text-primary">
|
||||
class="text-primary">
|
||||
<i class="fa fa-trash"></i>
|
||||
</a>
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
@model Webzine.WebApplication.Areas.Administration.ViewModels.Artiste.AdminArtisteForm
|
||||
|
||||
<div class="container">
|
||||
<!-- ARTISTE -->
|
||||
<div class="row mb-3 align-items-center">
|
||||
<label class="col-md-3 col-form-label">Nom de l'artiste<span class="text-danger">*</span></label>
|
||||
<div class="col-md-9">
|
||||
<input asp-for="Nom" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- BIOGRAPHIE -->
|
||||
<div class="row mb-3 align-items-center">
|
||||
<label class="col-md-3 col-form-label">Biographie<span class="text-danger">*</span></label>
|
||||
<div class="col-md-9">
|
||||
<input asp-for="Biographie" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- BOUTONS -->
|
||||
<div class="row mt-4">
|
||||
<div class="col-md-9 offset-md-3">
|
||||
|
||||
<button type="submit" class="btn btn-primary me-2">
|
||||
Sauvegarder
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<a asp-action="Index"
|
||||
class="btn text-primary">
|
||||
Retour à l'administration des artistes
|
||||
</a>
|
||||
</div>
|
||||
Reference in New Issue
Block a user