コード例 #1
0
    public async Task <ObjectId> HandleAsync(CancelOrderCommand request, CancellationToken cancellationToken)
    {
        var order = await _orderRepository.FindAsync(request.OrderId);

        order.SetCancelledStatus();
        return(ObjectId.GenerateNewId());
    }
コード例 #2
0
    /// <summary>
    /// Handler which processes the command when
    /// customer executes cancel order from app
    /// </summary>
    /// <param name="command"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    public async Task HandleAsync(DeleteOrderCommand command, CancellationToken cancellationToken)
    {
        var order = await _orderRepository.FindAsync(command.OrderId);

        if (order == null)
        {
            return;
        }

        await _orderRepository.DeleteAsync(order);
    }
コード例 #3
0
    /// <summary>
    /// Handler which processes the command when
    /// customer executes cancel order from app
    /// </summary>
    /// <param name="command"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    public async Task HandleAsync(ChangeOrderAddressCommand command, CancellationToken cancellationToken)
    {
        var order = await _orderRepository.FindAsync(command.OrderId);

        order?.ChangeAddress(command.NewAddress);
    }