Reputation: 789
I'm very new to Visual Studio, C#, and the MVC Framework, but I've come across an issue I can't resolve on my own.
I've started a new Web Project in Visual Studio with Single User Authentication. So Visual Studio generates all the stuff I need for the user to register to my site - perfecto.
However, I have another table of user data that I need to be filled with default data whenever a user signs up.
These will always start the same for each user - except for ID and then the foreign AspNetUserId. (You know, until they use the app).
This is the pre generated code that registers a user.
How can I edit this to simultaneously call a create method from my PDC_UserController to add data to my second table?
This is the code that would have to have the default values for the PDC_User table already specified.
Thanks for any help, I hope that's not too confusing
Upvotes: 1
Views: 539
Reputation: 488
You wouldn't call the create method... Just do your db.add call in the Account Controller where you already have the username and other data available. Something similar to below then save the changes after. You can look up examples if you need more specifics.
db.PDC_User.Add(new PDC_User{
DbRowName = defaultValue,
*etc*
}
Upvotes: 1