feat: implémenter le service de tableau de bord et DTO pour les statistiques du tableau de bord
This commit is contained in:
@@ -176,5 +176,37 @@ namespace Webzine.Repository
|
||||
throw new Exception("Erreur lors de la recherche d'artiste {error}", ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public int Count()
|
||||
{
|
||||
try
|
||||
{
|
||||
int count = this.context.Artistes.Count();
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -178,4 +178,20 @@ public class DbStyleRepository : IStyleRepository
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public int Count()
|
||||
{
|
||||
try
|
||||
{
|
||||
int count = this.context.Styles.Count();
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,5 +93,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,4 +56,10 @@ public class LocalStyleRepository : IStyleRepository
|
||||
{
|
||||
throw new NotSupportedException("Mode local");
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public int Count()
|
||||
{
|
||||
return this.dataStore.Styles.Count;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user