Merge branch 'dev' into j3/feat/business-logic/titre-admin
# Conflicts: # Webzine.Business/Webzine.Business.csproj # Webzine.WebApplication/Program.cs
This commit is contained in:
@@ -83,8 +83,8 @@ namespace Webzine.Repository
|
||||
try
|
||||
{
|
||||
Artiste artiste = this.context.Artistes
|
||||
.Include(a => a.Titres)
|
||||
.First(a => a.IdArtiste == id);
|
||||
.Include(a => a.Titres)
|
||||
.FirstOrDefault(a => a.IdArtiste == id);
|
||||
return artiste;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -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 = 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -178,4 +178,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -245,15 +245,13 @@ public class DbTitreRepository : ITitreRepository
|
||||
try
|
||||
{
|
||||
this.logger.LogDebug("Recherche du titre avec l'ID: {IdTitre}", idTitre);
|
||||
this.logger.LogDebug("Préparation de la requête avec les inclusions Artiste, Styles et Commentaires");
|
||||
|
||||
var titre = this.context.Titres
|
||||
.Include(t => t.Artiste)
|
||||
.Include(t => t.Styles)
|
||||
.Include(t => t.Commentaires)
|
||||
.First(t => t.IdTitre == idTitre);
|
||||
.FirstOrDefault(t => t.IdTitre == idTitre);
|
||||
|
||||
this.logger.LogDebug("Titre trouvé: {Libelle}", titre.Libelle);
|
||||
return titre;
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
|
||||
@@ -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