diff --git a/CarpentryWorkshop/CarpentryWorkshop/FormShop.cs b/CarpentryWorkshop/CarpentryWorkshop/FormShop.cs index 0de17b6..745c9c9 100644 --- a/CarpentryWorkshop/CarpentryWorkshop/FormShop.cs +++ b/CarpentryWorkshop/CarpentryWorkshop/FormShop.cs @@ -63,7 +63,7 @@ namespace CarpentryWorkshopView DataGridView.Rows.Clear(); foreach (var wood in _shopWoods) { - DataGridView.Rows.Add(new object[] { wood.Key, wood.Value.Item1.WoodName, wood.Value.Item2 }); + DataGridView.Rows.Add(new object[] { wood.Key, wood.Value.Item1.WoodName, wood.Value.Item1.Price,wood.Value.Item2 }); } } } diff --git a/CarpentryWorkshop/CarpentryWorkshopFileImplement/Implements/ShopStorage.cs b/CarpentryWorkshop/CarpentryWorkshopFileImplement/Implements/ShopStorage.cs index 6733450..67b3161 100644 --- a/CarpentryWorkshop/CarpentryWorkshopFileImplement/Implements/ShopStorage.cs +++ b/CarpentryWorkshop/CarpentryWorkshopFileImplement/Implements/ShopStorage.cs @@ -79,7 +79,11 @@ namespace CarpentryWorkshopFileImplement.Implements public bool CheckAvailability(int woodId, int count) { - int minus = source.Shops.Select(x => x.ShopWoods.Select(y => (y.Value.Item1.Id == woodId ? y.Value.Item2 : 0)).Sum()).Sum(); + int minus = source.Shops + .SelectMany(shop => shop.ShopWoods + .Where(wood => wood.Value.Item1.Id == woodId) + .Select(wood => wood.Value.Item2)) + .Sum(); count -= minus; return count <= 0; }