コード例 #1
0
        public async Task <IActionResult> Post([FromRoute] Guid orderId, [FromBody] OrderLineWrite value)
        {
            var orderIdKey  = OrderId.With(orderId);
            var orderLineId = OrderLineId.NewComb();
            var orderLine   = new OrderLine(orderLineId, ProductId.NewComb(), value.Title, value.Price, value.Amount);
            var cmd         = new AddOrderLine(orderIdKey, orderLine);

            await this._commandBus.PublishAsync(cmd, new CancellationToken()).ConfigureAwait(false);

            return(CreatedAtAction("Get", new { orderId = orderIdKey.Value, id = orderLineId.Value }, null));
        }