private async Task ConfirmOrderAsync()
        {
            if (_isUpdate)
            {
                await _orderManager.UpdateAsync(_newOrder).ConfigureAwait(false);
            }

            else
            {
                await _orderManager.CreateAsync(_newOrder).ConfigureAwait(false);
            }

            if (_createdOrderDetails.Count != 0)
            {
                await _orderDetailManager.CreateAsync(_createdOrderDetails).ConfigureAwait(false);
            }

            if (_updateOrderDetails.Count != 0)
            {
                foreach (var item in _updateOrderDetails)
                {
                    await _orderDetailManager.UpdateAsync(item).ConfigureAwait(false);
                }
            }

            if (_deleteOrderDetails.Count != 0)
            {
                await _orderDetailManager.DeleteAsync(_createdOrderDetails).ConfigureAwait(false);
            }
        }
Exemplo n.º 2
0
        private async Task DeleteOrder(OrderDto orderDto)
        {
            var order = await _orderManager.FindByIdAsync(orderDto.OrderID).ConfigureAwait(false);

            await _orderManager.DeleteAsync(order).ConfigureAwait(false);

            _orderDtoList.Remove(orderDto);
        }