C
C#4w 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
Davo4w ago
No description
Davo
Davo4w ago
The Actions
No description
Davo
Davo4w ago
No description
Angius
Angius4w ago
Don't use database entities for input models Don't use virtual either, it implies lazy loading and lazy loading is bad
Davo
Davo4w ago
You mean to say I should create like a ViewModel?
Angius
Angius4w 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
Davo4w ago
But before the Conditions when I debug and check I guess it should be Vaild
No description
Davo
Davo4w ago
Okay I'll try that Can anyone explain me how this form works btw?
Davo
Davo4w 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
Angius4w ago
Well, the <select> has asp-for that bunds it to PaymentMethod property of the model
Davo
Davo4w ago
How to do this?
No description
Angius
Angius4w ago
Do what?
Davo
Davo4w 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
Davo4w 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