public IHttpActionResult PostOrderCopy(OrderCopy orderCopy)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.OrderCopies.Add(orderCopy);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (OrderCopyExists(orderCopy.PId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = orderCopy.PId }, orderCopy));
        }
        public IHttpActionResult PutOrderCopy(int id, OrderCopy orderCopy)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != orderCopy.PId)
            {
                return(BadRequest());
            }

            db.Entry(orderCopy).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!OrderCopyExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult GetOrderCopy(int id)
        {
            OrderCopy orderCopy = db.OrderCopies.Find(id);

            if (orderCopy == null)
            {
                return(NotFound());
            }

            return(Ok(orderCopy));
        }
        public IHttpActionResult DeleteOrderCopy(int id)
        {
            OrderCopy orderCopy = db.OrderCopies.Find(id);

            if (orderCopy == null)
            {
                return(NotFound());
            }

            db.OrderCopies.Remove(orderCopy);
            db.SaveChanges();

            return(Ok(orderCopy));
        }