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:
https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/start-mvc?view=aspnetcore-6.0&t... 
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

6 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.

https://docs.microsoft.com/en-us/aspnet/mvc/overview/getting-started/getting-started-with-ef-using-m...

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

@NelPrinsloo_DVT 
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!