Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created October 25, 2015 10:31
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 justinyoo/1105fef94dbd6ebfafd6 to your computer and use it in GitHub Desktop.
Save justinyoo/1105fef94dbd6ebfafd6 to your computer and use it in GitHub Desktop.
[RoutePrefix("products")]
public class ProductController
{
[Route("{productId}")
public virtual async Product GetProduct(int productId)
{
var product = await this._service.GetProductAsync(productId);
product.Rel = "product";
product.Href = "/products/" + productId;
product.Links = new List<Link>()
{
new Link("self", "/products/" + productId),
new Link("find", "/products/{productId}"),
new Link("collection", "/products"),
};
return product;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment