Усложнённая лабораторная №2: Исправления

This commit is contained in:
Сергей Полевой 2023-03-26 02:14:04 +04:00
parent e59ed7e076
commit 18de1f0149
2 changed files with 4 additions and 3 deletions

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)