Compare commits

...

2 Commits

3 changed files with 6 additions and 5 deletions

View File

@ -177,9 +177,9 @@ namespace FlowerShopBusinessLogic.BusinessLogics
foreach (var shop in _shopStorage.GetFullList())
{
freeSpace += shop.MaxCountBouquets;
foreach (var doc in shop.ShopBouquets)
foreach (var bouq in shop.ShopBouquets)
{
freeSpace -= doc.Value.Item2;
freeSpace -= bouq.Value.Item2;
}
}

View File

@ -159,7 +159,7 @@ namespace FlowerShopBusinessLogic.BusinessLogics
return true;
}
private bool SellBouquet(IBouquetModel bouquet, int count)
public bool SellBouquet(IBouquetModel bouquet, int count)
{
return _shopStorage.SellBouquet(bouquet, count);
}
@ -183,7 +183,7 @@ namespace FlowerShopBusinessLogic.BusinessLogics
if (model.MaxCountBouquets < 0)
{
throw new InvalidOperationException("Магазин с отрицательным числом максимального количества букетов!")
throw new InvalidOperationException("Магазин с отрицательным числом максимального количества букетов!");
}
_logger.LogInformation("Shop. Name: {0}, Address: {1}, ID: {2}", model.Name, model.Address, model.Id);

View File

@ -3,6 +3,7 @@ using FlowerShopContracts.SearchModels;
using FlowerShopContracts.StoragesContracts;
using FlowerShopContracts.ViewModels;
using FlowerShopDataModels.Models;
using FlowerShopFileImplement.Models;
namespace FlowerShopFileImplement.Implements
{
@ -125,7 +126,7 @@ namespace FlowerShopFileImplement.Implements
foreach (var bouq in bouquets.Where(x => x.Value.Item1.Id == bouquet.Id))
{
var min = Math.Min(bouq.Value.Item2, count);
bouquets[bouq.Value.Item1.Id] = (bouq.Value.Item1, doc.Value.Item2 - min);
bouquets[bouq.Value.Item1.Id] = (bouq.Value.Item1, bouq.Value.Item2 - min);
count -= min;
if (count <= 0)