.NET MVC Project Help!
I'm unable to Create records using MVC it just blinks and nothing happen when I fill the form and click CREATE!
26 Replies
I'm unable to setup Forgein keys in different entity class
What is your code and what are the errors you see?
This is the code for the class
using the scaffolding there's no errors but its not working when I click create
Does it not add a new aeroplane?
No
How can you tell?
I tried I even looked in the database
and also if it to add it should redirect me to another view the Index View
It's only working when I'm commenting out the last line that is a reference
Did you add a new migration and update the database when you added that property?
Yes
Any reason that property is
virtual
, btw?
I'd look at three things:
1. Logs in the console
2. Browser devtools, specifically the network panel
3. Model state errors in the controllerAhmm I'm not sure
I would like to know if there some other way to add like a foreign key
that's what I'm trying to do basically have a foreign key so that I can have like the dropdown menu which is another issue
You add the foreign key to the other entity
The MVC creates the drop down itself right?
Idk if it scaffolds dropdowns like this
Haven't used scaffolding in years
I was just following a YT tutorial on making this project its confusing when it doesn't work while doing the exact same thing ðŸ˜
Could be they use an older version of the framework
But seeing how it uses
virtual
properties, which means they probably use lazy loading, it's not the best tutorial in the first placeYeah for sure its like a 4 years old playlist ðŸ˜
Not to mention property and class names not adhering to standard C# naming scheme
Get started with ASP.NET Core MVC
Learn how to get started with ASP.NET Core MVC.
btw I can see the FK being assigned
So the structure is correct, then
Go back to my list of issues to check, and check them
okay thanks!