#199 : Patch de la suppression des styles lors de la modification d'un titre.
This commit is contained in:
@@ -187,12 +187,14 @@ public class DbTitreRepository : ITitreRepository
|
||||
Titre existingTitre = this.Find(titre.IdTitre);
|
||||
if (existingTitre != null)
|
||||
{
|
||||
List<Style> stylesToApply = titre.Styles.ToList();
|
||||
|
||||
this.context.Entry(existingTitre).CurrentValues.SetValues(titre);
|
||||
|
||||
// Relation many-to-many
|
||||
this.context.Entry(existingTitre).Collection(t => t.Styles).Load();
|
||||
existingTitre.Styles.Clear();
|
||||
foreach (var style in titre.Styles)
|
||||
foreach (var style in stylesToApply)
|
||||
{
|
||||
existingTitre.Styles.Add(style);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user