#154 : Ajout de commentaire en suppression d'un fichier inutilisé.
This commit is contained in:
@@ -160,6 +160,10 @@ namespace Webzine.Repository
|
|||||||
{
|
{
|
||||||
try
|
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
|
var artiste = this.context.Artistes
|
||||||
.Where(a => a.Nom.ToLower().Contains(mot.ToLower()))
|
.Where(a => a.Nom.ToLower().Contains(mot.ToLower()))
|
||||||
.Include(t => t.Titres)
|
.Include(t => t.Titres)
|
||||||
|
|||||||
@@ -25,14 +25,23 @@ namespace Webzine.WebApplication.Controllers
|
|||||||
this.artisteRepository = artisteRepository;
|
this.artisteRepository = artisteRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Affichage de la page Recherche depuis le header de l'app.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mot">Nom d'artiste ou de titre.</param>
|
||||||
|
/// <returns>Page de recherche avec les résultats.</returns>
|
||||||
public IActionResult Index(string mot)
|
public IActionResult Index(string mot)
|
||||||
{
|
{
|
||||||
|
// Logger la recherche.
|
||||||
this.logger.LogInformation("Recherche artistes/titres pour le mot : {Mot}.", mot);
|
this.logger.LogInformation("Recherche artistes/titres pour le mot : {Mot}.", mot);
|
||||||
|
|
||||||
|
// Recherche des titres.
|
||||||
var titres = this.titreRepository.Search(mot);
|
var titres = this.titreRepository.Search(mot);
|
||||||
|
|
||||||
|
// Recherche des artistes.
|
||||||
var artistes = this.artisteRepository.Search(mot);
|
var artistes = this.artisteRepository.Search(mot);
|
||||||
|
|
||||||
|
// Paramètres a retourner à la vue.
|
||||||
var vm = new RechercheIndexViewModel
|
var vm = new RechercheIndexViewModel
|
||||||
{
|
{
|
||||||
Mot = mot,
|
Mot = mot,
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
namespace Webzine.WebApplication.ViewModels.Recherche;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ViewModel pour afficher un artiste dans les resultats de recherche.
|
|
||||||
/// </summary>
|
|
||||||
public class RechercheArtisteItem
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Nom de l'artiste.
|
|
||||||
/// </summary>
|
|
||||||
public string? Nom { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Nombre de titres associes a l'artiste.
|
|
||||||
/// </summary>
|
|
||||||
public int NombreDeTitres { get; set; }
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user