#154 : Déplacement de la recherche des artistes dans les RepositoryArtiste.

This commit is contained in:
Loic Masi
2026-03-31 13:30:47 +02:00
parent 6f009fcc3d
commit e5ecf75f49
5 changed files with 37 additions and 9 deletions

View File

@@ -4,8 +4,6 @@
namespace Webzine.Repository
{
using System.Data.Common;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
@@ -156,5 +154,23 @@ namespace Webzine.Repository
throw;
}
}
/// <inheritdoc/>
public IEnumerable<Artiste> Search(string mot)
{
try
{
var artiste = this.context.Artistes
.Where(a => a.Nom.ToLower().Contains(mot.ToLower()))
.Include(t => t.Titres)
.AsNoTracking()
.ToList();
return artiste;
}
catch (Exception ex)
{
throw new Exception("Erreur lors de la recherche d'artiste {error}", ex);
}
}
}
}

View File

@@ -85,5 +85,13 @@ namespace Webzine.Repository
{
throw new NotSupportedException("Mode Local");
}
/// <inheritdoc/>
public IEnumerable<Artiste> Search(string mot)
{
return this.dataStore.Artistes
.Where(a => a.Nom.ToLower().Contains(mot.ToLower()))
.ToList();
}
}
}