C
C#2mo ago
Davo

.NET MVC Doubt About Action (Method Post)

No description
7 Replies
Davo
DavoOP2mo ago
Basically I want to create a object of the Payment class and add it in the DB. So before that I would need all attributes of it so how can I proceed with it
Angius
Angius2mo ago
You should create a DTO — a class with only properties or a record — that has all the same properties your form does That will be the parameter in your POST method And based on that data, construct what you need and save it
Davo
DavoOP2mo ago
Can I have like
PaymentForm ( Payment paycheck)
PaymentForm ( Payment paycheck)
Angius
Angius2mo ago
Does Payment contain all the properties the form does and only the properties the form does? Seeing how it's your database entity, I'd wager that no, it does not So just make a new class
Davo
DavoOP2mo ago
its like there is only "One" new property I need from the Form that is the Payment Method and rest all properties are in with relations with other Classes objects
Angius
Angius2mo ago
You already have my answer It's not likely to change
Davo
DavoOP2mo ago
okayy
Want results from more Discord servers?
Add your server