I have a collection of posts created by separate users in my database.
- Each user can create posts and edit only their posts.
To edit their post, users navigate to a page "Posts/EditPost?PostID=x" where x is the post ID.
The "Posts" controller has an '[Authorize]' attribute and the GET part of the action checks to see if the post was made by the user.
If the user did indeed make the post, it renders the view. In the view there is a hidden field with the "PostID".
When the user submits the form, the POST part of the action rechecks if the PostID matches a post created by the current logged in User.
Is there a better way to accomplish this without having to double check if the user has access to edit the post, or is this the best way?