доделал

This commit is contained in:
goldfest 2024-04-05 00:04:34 +04:00
parent 14c13bec17
commit 53bb9dce47

View File

@ -123,6 +123,10 @@ namespace TravelCompanyBusinessLogic.BusinessLogics
{ {
throw new ArgumentException($"Поставка: Товар с id:{model.TravelId} не найденн"); throw new ArgumentException($"Поставка: Товар с id:{model.TravelId} не найденн");
} }
if (shop.ShopTravels.Sum(kv => kv.Value.Item2) + model.Count > shop.TravelMaxCount)
{
throw new ArgumentException("Превышена максимальная вместимость магазина");
}
shop.ShopTravels.Add(model.TravelId, (Travel, model.Count)); shop.ShopTravels.Add(model.TravelId, (Travel, model.Count));
} }
@ -139,6 +143,7 @@ namespace TravelCompanyBusinessLogic.BusinessLogics
return true; return true;
} }
private void CheckModel(ShopBindingModel model, bool withParams = true) private void CheckModel(ShopBindingModel model, bool withParams = true)
{ {
if (model == null) if (model == null)