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