#154 : Déplacement de la recherche des artistes dans les RepositoryArtiste.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user