public IHttpActionResult Post(int orderId, OrderLine orderLine)
 {
     orderLine.OrderId = orderId;
     return Created(orderLine);
 }
 public IHttpActionResult Put(int orderId, int lineId, OrderLine orderLine)
 {
     orderLine.OrderId = orderId;
     orderLine.ID = lineId;
     return Updated(orderLine);
 }
        public void GenerateLocationHeader_ForContainment()
        {
            // Arrange
            CustomersModelWithInheritance model = new CustomersModelWithInheritance();
            model.Model.SetAnnotationValue(model.OrderLine, new ClrTypeAnnotation(typeof(OrderLine)));
            var path = new DefaultODataPathHandler().Parse(
                model.Model,
                "http://localhost/",
                "MyOrders(1)/OrderLines");
            var request = GetODataRequest(model.Model);
            request.ODataProperties().Model = model.Model;
            request.ODataProperties().Path = path;
            var orderLine = new OrderLine { ID = 2 };
            var createdODataResult = new CreatedODataResult<OrderLine>(
                orderLine,
                _contentNegotiator,
                request,
                _formatters,
                _locationHeader);

            // Act
            var locationHeader = createdODataResult.GenerateLocationHeader();

            // Assert
            Assert.Equal("http://localhost/MyOrders(1)/OrderLines(2)", locationHeader.ToString());
        }