Revert "Временный костыль"

This reverts commit 49c182a591.
This commit is contained in:
Данияр Аглиуллов 2023-03-08 17:00:31 +04:00
parent 49c182a591
commit 7261bc6914

View File

@ -106,15 +106,11 @@ namespace ConfectioneryDatabaseImplement.Models
} }
} }
var shop = context.Shops.First(x => x.Id == model.Id); var shop = context.Shops.First(x => x.Id == model.Id);
foreach (var pc in model.Pastries) shop.ShopPastries.AddRange(model.Pastries.Select(x => new ShopPastry
{ {
context.PastryComponents.Add(new() Pastry = context.Pastries.First(y => y.Id == x.Key),
{ Count = x.Value.Item2,
Pastry = context.Pastries.First(y => y.Id == pc.Key), }).Except(shopPastries ?? new()));
Count = pc.Value.Item2,
});
context.SaveChanges();
}
context.SaveChanges(); context.SaveChanges();
_cachedPastries = null; _cachedPastries = null;
} }