Example #1
0
        public async Task <ActionResult> CreateOrderProductAsync(Guid orderId, [FromBody] OrderProductCreateDto model, CancellationToken cancellationToken = default)
        {
            var command = _mapper.Map <OrderProductCreateCommand>(model);

            command.OrderId = orderId;
            await _mediator.Send(command, cancellationToken);

            return(NoContent());
        }
Example #2
0
        public OrderProductDto CreateProductForOrder(OrderProductCreateDto orderProductCreateDto)
        {
            PedidoProducto pedidoProducto = new PedidoProducto
            {
                PedidoId   = orderProductCreateDto.OrderId,
                ProductoId = orderProductCreateDto.ProductId,
                Cantidad   = orderProductCreateDto.Quantity
            };

            _galaxyTallerContext.PedidoProducto.Add(pedidoProducto);
            _galaxyTallerContext.SaveChanges();

            return(GetProductForOrder(pedidoProducto.PedidoProductoId));
        }
 public OrderProductDto CreateProductForOrder(int orderId, OrderProductCreateDto orderProductCreateDto)
 {
     orderProductCreateDto.OrderId = orderId;
     return(_orderRepository.CreateProductForOrder(orderProductCreateDto));
 }
Example #4
0
        public ActionResult <OrderProductDto> CreateProductForOrder(int orderId, [FromBody] OrderProductCreateDto orderProductCreate)
        {
            OrderProductDto orderProduct = _orderApplicationService.CreateProductForOrder(orderId, orderProductCreate);

            return(Ok(orderProduct));
        }