i am new to asp.net mvc so please be explicit as possible.
Here is my goal:
i want to create a simple website where users can:
- Register and log in
- Enter there contact details(phone, address, etc)
- View there contact details
- Edit details of #3.
Later in the website, i will create other pages that use this data but for now the only items above are needed.
my questions is that i have been reviewing the default asp.net mvc sample that comes when you create a new asp.net mvc app.
I am trying to figure out if i should store all the contact details in the aspnetdb.mdf database in an existing table or i should be creating new tables.
it seems like i could extend aspnet_Users or aspnet_membership.
please let me know if these tables can be extended to store additional fields or if its safer to just create a new table in this database.
You could use an Asp.net profile provider to store the information. Follow the link for instructions on using the built-in SqlProfileProvider. By default, the SqlProfileProvider will create tables in the aspnetdb.mdf file, so you can keep everything in one place. You can access the profile provider as a property on the HttpContext.
Edit: Better link for ASP.Net profile information
Using the Profile provider, you don’t have to worry about making database calls or identifying the current user. It’s all done on your behalf. Double-check the documentation, because the following might be a little off.
You add the fields that you want in your web.config inside
<system.web>. In your case, it would be the necessary contact information.Then, you can access HttpContext.Profile.Address and so forth and the provider will take care of tying everything to the current user.
Adding and editing the information means displaying a form. Viewing the details is just displaying all the fields you saved from the previous form post.
The NerdDinner source and tutorial are well worth checking out if you’re completely new to MVC.