Balberova D.N. LabWork06Hard #13

Closed
august wants to merge 12 commits from LabWork06Hard into LabWork05Hard
Showing only changes of commit 26a38322ef - Show all commits

View File

@ -28,8 +28,18 @@ namespace SushiBarDatabaseImplement.Models
{
if (_shopSushi == null)
{
_shopSushi = ListSushiFk
.ToDictionary(recPC => recPC.SushiId, recPC => (recPC.Sushi as ISushiModel, recPC.Count));
_shopSushi = new();
ListSushiFk.ForEach(x =>
{
if (_shopSushi.ContainsKey(x.SushiId))
{
_shopSushi[x.SushiId] = (x.Sushi as ISushiModel, _shopSushi[x.SushiId].Item2 + x.Count);
}
else
{
_shopSushi[x.SushiId] = (x.Sushi as ISushiModel, x.Count);
}
});
}
return _shopSushi;
}