How to create pages with different permissions' views
I need some help to create pages with different views. Don't get me wrong, I don't want anyone to write code for me, I just want to know what I'll need to implement.
I'll detail what I need:
Ex: Facebook page. If I'm at my profile's page I have one type of view, I can edit all my data, see even not set data and add more information. If I'm visiting a friend's page I can only see what he wants me to and interact with his pages as far as he allowed me.
Ex2: One user posted info on some blog. He and all the people with privileges can edit that info, the other can only read and post comments as their permissions allow.
Was I clear enough?
I wasn't able to find Google references because I don't know the name of this technique and the keywords I type开发者_Go百科d didn't take me anywhere.
I appreciate any help.
Thanks.
You can render different views in actions or even redirect to different actions. For Example
public ActionResult Profile()
{
//Based on business logic, set variables
if(userProfile)
{
return View("Profile");
}
else if(friendProfile)
{
return View("FriendProfile");
}
}
精彩评论