#184 Implémentation des méthodes des repo en local. Suprression des exceptions de non implementation.

This commit is contained in:
josephine.vetu
2026-04-01 16:48:18 +02:00
parent 286397cb9e
commit afc9f1bdb4
4 changed files with 42 additions and 17 deletions

View File

@@ -31,19 +31,19 @@ public class LocalStyleRepository : IStyleRepository
/// <inheritdoc/>
public void Add(Style style)
{
throw new NotSupportedException("Mode local");
this.dataStore.Styles.Add(style);
}
/// <inheritdoc/>
public void Delete(Style style)
{
throw new NotSupportedException("Mode local");
this.dataStore.Styles.Remove(style);
}
/// <inheritdoc/>
public Style Find(int id)
{
return this.dataStore.Styles.Find(s => s.IdStyle == id);
return this.dataStore.Styles.SingleOrDefault(s => s.IdStyle == id);
}
/// <inheritdoc/>
@@ -55,6 +55,14 @@ public class LocalStyleRepository : IStyleRepository
/// <inheritdoc/>
public void Update(Style style)
{
throw new NotSupportedException("Mode local");
var stored = this.dataStore.Styles.FirstOrDefault(s => s.IdStyle == style.IdStyle);
if (stored == null)
{
this.logger.LogWarning("Style with id {IdStyle} not found for update.", style.IdStyle);
return;
}
stored.Libelle = style.Libelle;
stored.Titres = style.Titres;
}
}