public IHttpActionResult AddOrderDetail(int id, OrderDetailDTO orderDetailDTO)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            Order order = orderService.AddOrderDetail(id, OrderDetailDTO.FromOrderDetailDTO(orderDetailDTO, id));

            return(Ok(OrderDTO.ToOrderDTO(order)));
        }
        public IHttpActionResult DeleteOrder(int id)
        {
            Order order = orderService.DeleteOrderById(id);

            if (order == null)
            {
                return(NotFound());
            }
            return(Ok(OrderDTO.ToOrderDTO(order)));
        }
        public IHttpActionResult PostOrder(OrderDTO o)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            Order order = orderService.AddOrder(OrderDTO.FromOrderDTO(o));

            return(Ok(OrderDTO.ToOrderDTO(order)));
        }
        public IHttpActionResult GetOrderByBarCode(string barCode)
        {
            Order order = orderService.GetOneOrderByBarCode(barCode);

            if (order == null)
            {
                return(NotFound());
            }
            return(Ok(OrderDTO.ToOrderDTO(order)));
        }
        public IHttpActionResult PutOrder(int id, OrderDTO o)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            Order order = orderService.UpdateOrderById(id, OrderDTO.FromOrderDTO(o));

            if (order == null)
            {
                return(BadRequest());
            }
            return(Ok(OrderDTO.ToOrderDTO(order)));
        }
 //Pobranie wszystkich zamowien (metoda get)
 public IEnumerable <OrderDTO> GetOrders()
 {
     return(orderService.GetAllOrders().Select(o => OrderDTO.ToOrderDTO(o)));
 }
        public IHttpActionResult DeleteDetailOrder(int id, int number)
        {
            Order order = orderService.DeleteOrderDetailByNumber(id, number);

            return(Ok(OrderDTO.ToOrderDTO(order)));
        }