diff --git a/Webzine.Repository/DbArtisteRepository.cs b/Webzine.Repository/DbArtisteRepository.cs
index f12617c..fa6ff18 100644
--- a/Webzine.Repository/DbArtisteRepository.cs
+++ b/Webzine.Repository/DbArtisteRepository.cs
@@ -160,6 +160,10 @@ namespace Webzine.Repository
{
try
{
+ // Récupération des artistes et des titres
+ // qui leurs sont associés.
+ // ajout de 'ToLower' pour ne pas être sensible à la casse.
+ // NoTracking car action de lecture seulement.
var artiste = this.context.Artistes
.Where(a => a.Nom.ToLower().Contains(mot.ToLower()))
.Include(t => t.Titres)
diff --git a/Webzine.WebApplication/Controllers/RechercheController.cs b/Webzine.WebApplication/Controllers/RechercheController.cs
index cb8e734..2d5c4b9 100644
--- a/Webzine.WebApplication/Controllers/RechercheController.cs
+++ b/Webzine.WebApplication/Controllers/RechercheController.cs
@@ -25,14 +25,23 @@ namespace Webzine.WebApplication.Controllers
this.artisteRepository = artisteRepository;
}
+ ///
+ /// Affichage de la page Recherche depuis le header de l'app.
+ ///
+ /// Nom d'artiste ou de titre.
+ /// Page de recherche avec les résultats.
public IActionResult Index(string mot)
{
+ // Logger la recherche.
this.logger.LogInformation("Recherche artistes/titres pour le mot : {Mot}.", mot);
+ // Recherche des titres.
var titres = this.titreRepository.Search(mot);
+ // Recherche des artistes.
var artistes = this.artisteRepository.Search(mot);
+ // Paramètres a retourner à la vue.
var vm = new RechercheIndexViewModel
{
Mot = mot,
diff --git a/Webzine.WebApplication/ViewModels/Recherche/RechercheArtisteItem.cs b/Webzine.WebApplication/ViewModels/Recherche/RechercheArtisteItem.cs
deleted file mode 100644
index d179c3f..0000000
--- a/Webzine.WebApplication/ViewModels/Recherche/RechercheArtisteItem.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-namespace Webzine.WebApplication.ViewModels.Recherche;
-
-///
-/// ViewModel pour afficher un artiste dans les resultats de recherche.
-///
-public class RechercheArtisteItem
-{
- ///
- /// Nom de l'artiste.
- ///
- public string? Nom { get; set; }
-
- ///
- /// Nombre de titres associes a l'artiste.
- ///
- public int NombreDeTitres { get; set; }
-}
\ No newline at end of file