Advertisement
Guest User

Untitled

a guest
Oct 4th, 2015
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. [AuthorizeProduct]
  2. public IHttpActionResult Get (int id)
  3. {
  4. Product product = _repository.Get (id);
  5. if (product == null)
  6. {
  7. return NotFound();
  8. }
  9. return Ok(product);
  10. }
  11.  
  12. public class AuthorizeProductAttribute : AuthorizationFilterAttribute
  13. {
  14. public override void OnAuthorization(
  15. System.Web.Http.Controllers.HttpActionContext actionContext)
  16. {
  17. //do authorization
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement