Skip to content

Instantly share code, notes, and snippets.

@glennblock
Created January 8, 2012 04:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glennblock/1577207 to your computer and use it in GitHub Desktop.
Save glennblock/1577207 to your computer and use it in GitHub Desktop.
Web API - Order link handler
public class OrderLinkHandler : HttpOperationHandler<ILinkable<Order>,ILinkable<Order>>
{
public ILinkable<Order> OnHandle(ILinkable<Order> linkedOrder) {
if (linkedOrder.Instance.State == OrderStates.Created) {
linkedOrder.Links.Add(OrderLinks.Approval,
GetApprovalUri(order.ID));
}
//other state logic here
return linkedOrder;
}
private Uri GetApprovalUri(orderId) {
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment