Multiple tables in MVC application

New Contributor

Hello all,

I am new to the ASP.NET Core and MVC development.

My goal is to create a simple Movie Management Web Application, just like the one in this tutorial: 
I already followed this tutorial 2 times, to learn the concept.
But there is something missing.
I want to separate the Genre from Movie in my database.
I must have two tables: Movie and Genre. They must be linked by the Foreign Key GenreID in the Movie table.
As the above tutorial doesn't show me how to do it. I would like to get your help here.
How do I generate the database properly from my models?
PS: I already created two Models classes: Movie and Genre.
After scaffolding, only one table was generated in the database: Movie.
The Genre table was completely ignored.

Thank you

7 Replies
If you have a look at the tutorial mentioned below, it has some good examples of how to define entity classes and relationships between them using Entity Framework.

Hi @Konstantin_Pankratov,

Thanks for posting your issue here.

However this platform is used for how-to discussions and sharing best practices for building any app with .NET.Since your issue is a technical question, welcome to post it in Microsoft Q&A forum, the support team and communities on Microsoft Q&A will help you for any technical questions.
Besides, it will be appreciated if you can share it here once you post this technical question Microsoft Q&A.
Best Regards,
Lan Huang

Thank you for the link.
I find that really strange that's to see a note at the beginning of this article, that the MVC is outdated and you should switch to Razor instead.
While in Razor, they say that it is better to use MVC.

A really confusing information...

Thank you. I have posted there too.
Trying to deploy an ASP.NET application. I have deployed the site to IIS, but when visiting it with the browser, it shows me this:

Server Error

500 - Internal server error.

There is a problem with the resource you are looking for, and it cannot be displayed.


What would be the possible solution for this. Server is working fine for other projects.





The page cannot be displayed because an internal server error has occurred.





Need Your Help Reply ASAP!                                 

I notice your question has remained outstanding for quite some time. Did you manage to find a solution? I would look at the IIS logs as well as the Event logs in Event viewer on the machine on which you are attempting to host the site.


There can be various errors that could result in a HTTP Status code of 500 - only way to find out what the issue is would be to look at the log files.