Exemplo n.º 1
0
        public async Task <IActionResult> InitCart([FromBody] InitCartRequest request)
        {
            Guard.Against.Null(request, nameof(request));

            var cartId = idGenerator.New();

            var command = Commands.InitCart.Create(
                cartId,
                request.ClientId
                );

            await commandBus.Send(command);

            return(Created("api/Carts", cartId));
        }
Exemplo n.º 2
0
    public async Task <IActionResult> InitCart([FromBody] InitCartRequest request)
    {
        if (request == null)
        {
            throw new ArgumentNullException(nameof(request));
        }

        var cartId = idGenerator.New();

        var command = InitializeCart.Create(
            cartId,
            request.ClientId
            );

        await commandBus.Send(command);

        return(Created("api/Carts", cartId));
    }