Какие то изменения

This commit is contained in:
Никита Потапов 2024-04-08 12:42:08 +04:00
parent dcba13f0ed
commit 19415b5c7b

View File

@ -181,9 +181,7 @@ namespace SecuritySystemBusinessLogic.BusinessLogics
public bool CheckSecuresCount(ISecureModel model, int count) public bool CheckSecuresCount(ISecureModel model, int count)
{ {
int securesInShops = _shopStorage.GetFullList() int securesInShops = _shopStorage.GetFullList()
.Select( .Select(x => x.ShopSecures.Select(y => y.Value.Item1.Id == model.Id ? y.Value.Item2 : 0).Sum()).Sum();
x => x.ShopSecures.Select(y => y.Value.Item1.Id == model.Id ? y.Value.Item2 : 0).Sum()
).Sum();
return securesInShops >= count; return securesInShops >= count;
} }
public bool CheckSupplySecures(ShopSearchModel shopSearchModel, int count) public bool CheckSupplySecures(ShopSearchModel shopSearchModel, int count)
@ -191,9 +189,6 @@ namespace SecuritySystemBusinessLogic.BusinessLogics
if (shopSearchModel == null) if (shopSearchModel == null)
throw new ArgumentNullException(nameof(shopSearchModel)); throw new ArgumentNullException(nameof(shopSearchModel));
if (secure == null)
throw new ArgumentNullException(nameof(secure));
var shop = _shopStorage.GetElement(shopSearchModel); var shop = _shopStorage.GetElement(shopSearchModel);
if (shop == null) if (shop == null)