title: Custom authorize using MVC
body: <p>I'm working a bit with MVC. I need to know something about roles when using the same controller for several users getting and showing pictures.</p>
  
  <p>I need to show pictures, but sometimes these pictures should only be shown for those who created them. So now when using the Authorize attribute and if picture and username match thrue my database I could, of course, use this to make a match. I could, of course, make a match method in the controller.</p>
  
  <pre><code>[Authorize]
  controllGetPicture(Picture ID){
  
  getSomepicture..
  
  return picture
  }
  
  DB relations
  
  Relations
  [User] &lt;-&gt; [Pictures]
  ID         FK_UserID
  </code></pre>
  
  <p>Im thinking about just getting the User ID and compare with the Picture <code>FK_UserId</code> at the picture but I think it could be smarter. How? </p>