Created
October 25, 2015 10:31
-
-
Save justinyoo/1105fef94dbd6ebfafd6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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