#184 Implémentation des méthodes des repo en local. Suprression des exceptions de non implementation.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user