Merge branch 'dev' into j3/TODO_erreurs

This commit is contained in:
josephine.vetu
2026-04-01 17:41:27 +02:00
26 changed files with 281 additions and 74 deletions

View File

@@ -168,5 +168,37 @@ namespace Webzine.Repository
throw new Exception("Erreur lors de la recherche d'artiste {error}", ex);
}
}
/// <inheritdoc/>
public int Count()
{
try
{
int count = Enumerable.Count(this.context.Artistes);
this.logger.LogDebug("Nombre total d'artistes dans la base: {Count}", count);
return count;
}
catch (Exception ex)
{
this.logger.LogError(ex, "Erreur lors du comptage des artistes.");
throw;
}
}
/// <inheritdoc/>
public int Count(Func<Artiste, bool> predicate)
{
try
{
int count = this.context.Artistes.Count(predicate);
this.logger.LogDebug("Nombre d'artistes (avec prédicat): {Count}", count);
return count;
}
catch (Exception ex)
{
this.logger.LogError(ex, "Erreur lors du comptage des artistes avec prédicat.");
throw;
}
}
}
}

View File

@@ -167,4 +167,20 @@ public class DbStyleRepository : IStyleRepository
throw;
}
}
/// <inheritdoc/>
public int Count()
{
try
{
int count = Enumerable.Count(this.context.Styles);
this.logger.LogDebug("Nombre total de styles: {Count}", count);
return count;
}
catch (Exception ex)
{
this.logger.LogError(ex, "Erreur lors du comptage des styles");
throw;
}
}
}

View File

@@ -94,5 +94,17 @@ namespace Webzine.Repository
.Where(a => a.Nom.ToLower().Contains(mot.ToLower()))
.ToList();
}
/// <inheritdoc/>
public int Count()
{
return this.dataStore.Artistes.Count;
}
/// <inheritdoc/>
public int Count(Func<Artiste, bool> predicate)
{
return this.dataStore.Artistes.Count(predicate);
}
}
}

View File

@@ -65,4 +65,10 @@ public class LocalStyleRepository : IStyleRepository
stored.Libelle = style.Libelle;
stored.Titres = style.Titres;
}
/// <inheritdoc/>
public int Count()
{
return this.dataStore.Styles.Count;
}
}