написал locker

This commit is contained in:
gg12 darfren 2024-04-16 12:04:51 +04:00
parent c900b5e586
commit 99119e1652

View File

@ -18,6 +18,7 @@ namespace IceCreamShopBusinessLogic.BusinessLogic
{ {
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IOrderStorage _orderStorage; private readonly IOrderStorage _orderStorage;
static readonly object locker = new object();
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage) public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage)
{ {
@ -92,7 +93,10 @@ namespace IceCreamShopBusinessLogic.BusinessLogic
public bool TakeOrderInWork(OrderBindingModel model) public bool TakeOrderInWork(OrderBindingModel model)
{ {
return ChangeStatus(model, OrderStatus.Выполняется); lock (locker)
{
return ChangeStatus(model, OrderStatus.Выполняется);
}
} }
public bool FinishOrder(OrderBindingModel model) public bool FinishOrder(OrderBindingModel model)