From fdce636b56420ba2a75659e86cfebac6814b5cdf Mon Sep 17 00:00:00 2001 From: "a.puchkina" Date: Thu, 23 May 2024 22:48:05 +0400 Subject: [PATCH] =?UTF-8?q?2=20=D0=BB=D0=B0=D0=B1=D0=B0=20=D1=83=D1=81?= =?UTF-8?q?=D0=BB=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 5 +++++ .../TracelCompanyFileImplement/Implements/ShopStorage.cs | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index ca1c7a3..d3d1a92 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,11 @@ # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs +# dll файлы +*.dll + +/TravelCompany/ImplementationExtensions + # Mono auto generated files mono_crash.* diff --git a/TravelCompany/TracelCompanyFileImplement/Implements/ShopStorage.cs b/TravelCompany/TracelCompanyFileImplement/Implements/ShopStorage.cs index 68731ec..4b1c99a 100644 --- a/TravelCompany/TracelCompanyFileImplement/Implements/ShopStorage.cs +++ b/TravelCompany/TracelCompanyFileImplement/Implements/ShopStorage.cs @@ -88,7 +88,9 @@ namespace TravelCompanyFileImplement.Implements public bool MakeSale(ITravelModel model, int count) { var travel = source.Travels.FirstOrDefault(x => x.Id == model.Id); - int countInShops = source.Shops.SelectMany(x => x.ShopTravels).Sum(y => y.Key == model.Id ? y.Value.Item2 : 0); + int countInShops = source.Shops.SelectMany(x => x.ShopTravels) + .Where(y => y.Value.Item1.Id == model.Id) + .Sum(y => y.Value.Item2); if (travel == null || countInShops < count) {