예제 #1
0
        private async void Tick(object state)
        {
            while (_queueServices.Shop.Pending)
            {
                if (!await _shopService.Check())
                {
                    break;
                }
                await _queueServices.Shop.Execute();
            }

            while (_queueServices.Order.Pending)
            {
                if (!await _orderService.Check())
                {
                    break;
                }
                await _queueServices.Order.Execute();
            }
        }
예제 #2
0
        public async Task <ActionResult> Delete(string id)
        {
            try
            {
                if (await _orderService.Check())
                {
                    await _orderService.RemoveByShopId(id);
                }
                else
                {
                    _queueServices.Order.Add(async() =>
                    {
                        await _orderService.RemoveByShopId(id);
                    });
                }

                if (await _shopService.Check())
                {
                    await _shopService.Remove(id);
                }
                else
                {
                    _queueServices.Shop.Add(async() =>
                    {
                        await _shopService.Remove(id);
                    });
                }

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(new ResponseError()
                {
                    ErrorCode = 400, Message = ex.Message
                }));
            }
        }