I’m plan to develop an asp.net mvc 4 (and simplemembership) website with Entity Framewok, which will handle multiple users. A user has a page, like a facebook profile page, that it may post or edit. And I would like others users can also view and post on this page, but not edit those post, like facebook again.
I’m looking for an hour now some informations about how doing it, but I’ve found nothing. I’m new in asp.net and I don’t know all the means. Roles do not seem to handle this kind of actions. Is there a way to do something like, in my controller, i can do something like when I create a post, i say the logged in user is owner, just him could delete this post, but all others could see it. But still, i don’t know how to do for each user has his profile’s page.
I take all advices, links to tuto or articles, reflections, ideas…
(sorry for my bad english)
Thank you
You can look up the currently logged in user using simplemembership like this:
To get the current user you can query your repository, like this for example:
EDIT2: Missed changing a field from my Model to yours, fixed
Based on your comment, i’ll try to write a small example using the standard Scaffolded CRUD Delete Method in MVC4 and this assumes the Post model has a UserId property/field: