#184 Implémentation des méthodes des repo en local. Suprression des exceptions de non implementation.
This commit is contained in:
@@ -28,7 +28,7 @@ public class LocalTitreRepository : ITitreRepository
|
||||
/// <inheritdoc/>
|
||||
public void Add(Titre titre)
|
||||
{
|
||||
throw new NotSupportedException("Mode local");
|
||||
this.dataStore.Titres.Add(titre);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -41,7 +41,7 @@ public class LocalTitreRepository : ITitreRepository
|
||||
/// <inheritdoc/>
|
||||
public void Delete(Titre titre)
|
||||
{
|
||||
throw new NotSupportedException("Mode Local");
|
||||
this.dataStore.Titres.Remove(titre);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -115,6 +115,18 @@ public class LocalTitreRepository : ITitreRepository
|
||||
/// <inheritdoc/>
|
||||
public void Update(Titre titre)
|
||||
{
|
||||
throw new NotSupportedException("Mode local");
|
||||
var stored = this.dataStore.Titres.FirstOrDefault(t => t.IdTitre == titre.IdTitre);
|
||||
if (stored == null)
|
||||
{
|
||||
this.logger.LogWarning("Titre avec l'ID {Id} non trouvé pour mise à jour.", titre.IdTitre);
|
||||
return;
|
||||
}
|
||||
|
||||
stored.Libelle = titre.Libelle;
|
||||
stored.DateCreation = titre.DateCreation;
|
||||
stored.NbLectures = titre.NbLectures;
|
||||
stored.NbLikes = titre.NbLikes;
|
||||
stored.IdArtiste = titre.IdArtiste;
|
||||
stored.Styles = titre.Styles;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user