C
C#3mo ago
Davo

.NET MVC Project Issue

I'm unable to figure out why my ModelState is going False
No description
15 Replies
blueberriesiftheywerecats
Show Payment class and how you are sending request
Davo
DavoOP3mo ago
No description
Davo
DavoOP3mo ago
The Actions
No description
Davo
DavoOP3mo ago
No description
Angius
Angius3mo ago
Don't use database entities for input models Don't use virtual either, it implies lazy loading and lazy loading is bad
Davo
DavoOP3mo ago
You mean to say I should create like a ViewModel?
Angius
Angius3mo ago
Yes The issue is that the form does not fill all of the properties of your Payment. Using a viewmodel that is 1:1 with what the form provides will fix that
Davo
DavoOP3mo ago
But before the Conditions when I debug and check I guess it should be Vaild
No description
Davo
DavoOP3mo ago
Okay I'll try that Can anyone explain me how this form works btw?
Davo
DavoOP3mo ago
I'm still in doubt how did they Payment Method that the form took as input is passed on in the object
No description
Angius
Angius3mo ago
Well, the <select> has asp-for that bunds it to PaymentMethod property of the model
Davo
DavoOP3mo ago
How to do this?
No description
Angius
Angius3mo ago
Do what?
Davo
DavoOP3mo ago
its all messed up I can't understand how these forms and action are passing values with each other Ah I was trying to redirect that action but I see we cannot pass such complex class in the parameter or as a route id
Davo
DavoOP3mo ago
This is my FormAction and its view takes in differen't attributes of payment class
No description
Want results from more Discord servers?
Add your server