public async Task <CreateOrderResponse> AddDetailToOrder(IEnumerable <OrderDetail> orderDetail)
        {
            _orderRepository.AddDetailToOrder(orderDetail);
            await _unitOfWork.CompleteAsync();

            return(new CreateOrderResponse(true, null, orderDetail.First()));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> AddDetail(int id, [FromBody] OrderDetailModel detail)
        {
            try
            {
                OrderDetailModel createdDetail = await _orders.AddDetailToOrder(id, detail);

                return(CreatedAtAction(
                           nameof(GetDetail), new { orderId = id, rowId = createdDetail.Id }, createdDetail));
            }
            catch (EntityNotFoundException <OrderModel> )
            {
                return(NotFound());
            }
        }