C
C#•2mo ago
Davo

.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
Davo
Davo•2mo ago
I'm unable to setup Forgein keys in different entity class
Angius
Angius•2mo ago
What is your code and what are the errors you see?
Davo
Davo•2mo ago
This is the code for the class
No description
Davo
Davo•2mo ago
using the scaffolding there's no errors but its not working when I click create
No description
Angius
Angius•2mo ago
Does it not add a new aeroplane?
Davo
Davo•2mo ago
No
Angius
Angius•2mo ago
How can you tell?
Davo
Davo•2mo ago
I tried I even looked in the database and also if it to add it should redirect me to another view the Index View
Davo
Davo•2mo ago
No description
Davo
Davo•2mo ago
It's only working when I'm commenting out the last line that is a reference
Angius
Angius•2mo ago
Did you add a new migration and update the database when you added that property?
Davo
Davo•2mo ago
Yes
Angius
Angius•2mo ago
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 controller
Davo
Davo•2mo ago
Ahmm I'm not sure I would like to know if there some other way to add like a foreign key
Davo
Davo•2mo ago
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
No description
Angius
Angius•2mo ago
You add the foreign key to the other entity
Davo
Davo•2mo ago
The MVC creates the drop down itself right?
Angius
Angius•2mo ago
Idk if it scaffolds dropdowns like this Haven't used scaffolding in years
Davo
Davo•2mo ago
I was just following a YT tutorial on making this project its confusing when it doesn't work while doing the exact same thing 😭
Angius
Angius•2mo ago
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 place
Davo
Davo•2mo ago
Yeah for sure its like a 4 years old playlist 😭
Angius
Angius•2mo ago
Not to mention property and class names not adhering to standard C# naming scheme
Davo
Davo•2mo ago
btw I can see the FK being assigned
No description
Angius
Angius•2mo ago
So the structure is correct, then Go back to my list of issues to check, and check them
Davo
Davo•2mo ago
okay thanks!
Want results from more Discord servers?
Add your server