parent
49c182a591
commit
7261bc6914
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user