Ajout du moteur de recherche dans le header

This commit is contained in:
Loic Masi
2026-03-10 21:38:40 +01:00
parent ae1ee725a9
commit 47b3c0bdd7
12 changed files with 334 additions and 93 deletions

View File

@@ -0,0 +1,85 @@
@model Webzine.WebApplication.ViewModels.Recherche.RechercheIndexViewModel
@{
ViewData["Title"] = "Recherche";
Layout = "_Layout";
}
<div class="container mt-4">
<div class="row">
<div class="col-md-8">
<h1 class="mb-4">Resultats pour "@Model.Mot"</h1>
<hr />
@if (string.IsNullOrWhiteSpace(Model.Mot))
{
<div class="alert alert-info">
Saisissez un mot-cle pour lancer une recherche.
</div>
}
else if (!Model.Artistes.Any() && !Model.Titres.Any())
{
<div class="alert alert-info">
Aucun artiste ni titre ne correspond a votre recherche.
</div>
}
else
{
@if (Model.Artistes.Any())
{
<h2 class="h4 mt-4">Artistes</h2>
@foreach (var artiste in Model.Artistes)
{
<div class="my-3">
<a asp-controller="Artiste"
asp-action="Index"
asp-route-nom="@artiste.Nom">
@artiste.Nom
</a>
<span class="text-muted">(@artiste.NombreDeTitres titre(s))</span>
</div>
}
}
@if (Model.Titres.Any())
{
<h2 class="h4 mt-4">Titres</h2>
@foreach (var titre in Model.Titres)
{
<div class="d-flex align-items-start my-3">
<a asp-controller="Titre"
asp-action="Details"
asp-route-id="@titre.IdTitre"
class="me-3 text-black">
<img src="@titre.UrlJaquette" alt="@titre.Libelle" width="70" height="70" class="object-fit-cover" />
</a>
<div class="justify-content-center d-flex flex-column">
<div>
<a asp-controller="Artiste"
asp-action="Index"
asp-route-nom="@titre.ArtisteNom">
@titre.ArtisteNom
</a>
-
<a asp-controller="Titre"
asp-action="Details"
asp-route-id="@titre.IdTitre">
@titre.Libelle
</a>
</div>
<div>
Duree : @TimeSpan.FromSeconds(titre.Duree).ToString(@"mm\:ss")
</div>
</div>
</div>
}
}
}
</div>
</div>
</div>

View File

@@ -3,11 +3,11 @@
*@
@{
}
<div class="text-bg-light my-2 pb-0">
<footer class="d-flex flex-wrap justify-content-between align-items-center py-3 my-4">
<div class="site-footer text-bg-light mt-auto">
<footer class="d-flex flex-wrap justify-content-between align-items-center py-3">
<div class="col-md-4 d-flex align-items-center">
<span class="mb-3 mb-md-0 ms-5 text-body-secondary">&copy; ASP .NET Core - DIIAGE 2025 - 2026</span>
</div>
</footer>
</div>
</div>

View File

@@ -62,10 +62,13 @@
</ul>
<!-- Barre de recherche -->
<form class="d-flex">
<form class="d-flex" asp-controller="Recherche" asp-action="Index" method="post">
<div class="input-group">
<div class="form-outline">
<input class="form-control me-2" type="search" placeholder="Trouver un artiste / titre">
<input class="form-control me-2"
type="search"
name="mot"
placeholder="Trouver un artiste, un titre ou un style">
</div>
<button class="btn btn-primary" type="submit">
<i class="fa-solid fa-magnifying-glass"></i>
@@ -75,4 +78,4 @@
</div>
</div>
</nav>
</header>
</header>

View File

@@ -15,18 +15,20 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
</head>
<body>
<div class="pb-0 mb-0">
<div class="site-shell">
<partial name="_Header"/>
<div class="row mt-5">
<main class="col mx-3">
@RenderBody()
</main>
@if(ViewContext.RouteData.Values["area"]?.ToString() != "Administration")
{
<partial name="_Sidebar" />
}
<div class="container-fluid flex-grow-1 py-4">
<div class="row g-0">
<main class="col mx-3">
@RenderBody()
</main>
@if(ViewContext.RouteData.Values["area"]?.ToString() != "Administration")
{
<partial name="_Sidebar" />
}
</div>
</div>
<partial name="_Footer" />
</div>
</body>
</html>
</html>