I'm trying to produce a site application using MVC 3- The issue is I wish to setup an internet site in which a user signs in they see data only specific for them. For instance whenever you log into facebook, you simply call at your "wall" and never other bands.
Can someone point me to some tutorial regarding how to setup a database where data could be attached to a person?
thanks ahead of time!
Possess a table in your data model that utilizes a principal key UserName. This is actually the value which will pick which wall you show towards the user.
Whenever a user registers, once you create them while using ASP.Internet Membership Provider, give a new row towards the Customers table giving exactly the same UserName because the UserName within the membership provider (for simplicity, we use current email address for username -- simpler to ensure originality). You are able to execute queries for his or her wall data using the User property from the Controller class.
- User registers, you produce a user take into account them (Membership.CreateUser)
- At same time as Membership.CreateUser, place UserName right into a row in your data model
- User signs in
- User demands page
- Page uses the Controller.User property to question your application database for that correct wall content to show.
I recommend a few of the lessons at asp.net/mvc. I don't know if Nerd Dinner continues to be up-to-date for MVC3 (an excellent tutorial incidentally, compiled by Scott Guthrie), however it appears like the next tutorial has login functionality and describes in a fundamental level how to deal with user specific data: