Compare commits
2 Commits
242d9ab771
...
18de1f0149
Author | SHA1 | Date | |
---|---|---|---|
18de1f0149 | |||
e59ed7e076 |
@ -177,9 +177,9 @@ namespace FlowerShopBusinessLogic.BusinessLogics
|
|||||||
foreach (var shop in _shopStorage.GetFullList())
|
foreach (var shop in _shopStorage.GetFullList())
|
||||||
{
|
{
|
||||||
freeSpace += shop.MaxCountBouquets;
|
freeSpace += shop.MaxCountBouquets;
|
||||||
foreach (var doc in shop.ShopBouquets)
|
foreach (var bouq in shop.ShopBouquets)
|
||||||
{
|
{
|
||||||
freeSpace -= doc.Value.Item2;
|
freeSpace -= bouq.Value.Item2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ namespace FlowerShopBusinessLogic.BusinessLogics
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool SellBouquet(IBouquetModel bouquet, int count)
|
public bool SellBouquet(IBouquetModel bouquet, int count)
|
||||||
{
|
{
|
||||||
return _shopStorage.SellBouquet(bouquet, count);
|
return _shopStorage.SellBouquet(bouquet, count);
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ namespace FlowerShopBusinessLogic.BusinessLogics
|
|||||||
|
|
||||||
if (model.MaxCountBouquets < 0)
|
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);
|
_logger.LogInformation("Shop. Name: {0}, Address: {1}, ID: {2}", model.Name, model.Address, model.Id);
|
||||||
|
@ -3,6 +3,7 @@ using FlowerShopContracts.SearchModels;
|
|||||||
using FlowerShopContracts.StoragesContracts;
|
using FlowerShopContracts.StoragesContracts;
|
||||||
using FlowerShopContracts.ViewModels;
|
using FlowerShopContracts.ViewModels;
|
||||||
using FlowerShopDataModels.Models;
|
using FlowerShopDataModels.Models;
|
||||||
|
using FlowerShopFileImplement.Models;
|
||||||
|
|
||||||
namespace FlowerShopFileImplement.Implements
|
namespace FlowerShopFileImplement.Implements
|
||||||
{
|
{
|
||||||
@ -125,7 +126,7 @@ namespace FlowerShopFileImplement.Implements
|
|||||||
foreach (var bouq in bouquets.Where(x => x.Value.Item1.Id == bouquet.Id))
|
foreach (var bouq in bouquets.Where(x => x.Value.Item1.Id == bouquet.Id))
|
||||||
{
|
{
|
||||||
var min = Math.Min(bouq.Value.Item2, count);
|
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;
|
count -= min;
|
||||||
|
|
||||||
if (count <= 0)
|
if (count <= 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user