From 71f60ebf7a36756de4656dfbe73503058eace038 Mon Sep 17 00:00:00 2001 From: Danila_Mochalov Date: Fri, 7 Apr 2023 16:05:54 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Implements/ShopStorage.cs | 71 ------------------- 1 file changed, 71 deletions(-) diff --git a/LawFirm/LawFirmFileImplement/Implements/ShopStorage.cs b/LawFirm/LawFirmFileImplement/Implements/ShopStorage.cs index a4128a2..09a4599 100644 --- a/LawFirm/LawFirmFileImplement/Implements/ShopStorage.cs +++ b/LawFirm/LawFirmFileImplement/Implements/ShopStorage.cs @@ -81,77 +81,6 @@ namespace LawFirmFileImplement.Implements return shop.GetViewModel; } -/* public bool SellDocument(IDocumentModel model, int count) - { - // переделать под linq - - var document = source.Documents.FirstOrDefault(x => x.Id == model.Id); - - var countStore = count; - - if (document == null) - { - return false; - } - - foreach (var shop in source.Shops) - { - foreach (var doc in shop.ShopDocuments) - { - if (doc.Value.Item1.Id == document.Id) - { - count -= doc.Value.Item2; - } - if (count <= 0) - { - break; - } - } - } - - if (count > 0) - { - return false; - } - - count = countStore; - - for (int i = 0; i < source.Shops.Count; i++) - { - var shop = source.Shops[i]; - var documents = shop.ShopDocuments; - - foreach (var doc in documents.Where(x => x.Value.Item1.Id == document.Id)) - { - var min = Math.Min(doc.Value.Item2, count); - documents[doc.Value.Item1.Id] = (doc.Value.Item1, doc.Value.Item2 - min); - count -= min; - - if (count <= 0) - { - break; - } - } - - shop.Update(new ShopBindingModel - { - Id = shop.Id, - Name = shop.Name, - Adress = shop.Adress, - OpeningDate = shop.OpeningDate, - MaxCountDocuments = shop.MaxCountDocuments, - ShopDocuments = documents - }); - source.SaveShops(); - } - - if (count > 0) - { - return false; - } - return true; - } -*/ public bool SellDocument(IDocumentModel model, int count) { var document = source.Documents.FirstOrDefault(x => x.Id == model.Id);