C
C#4w ago
Davo

.NET MVC Doubt About Action (Method Post)

No description
7 Replies
Davo
Davo4w 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
Angius4w 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
Davo4w ago
Can I have like
PaymentForm ( Payment paycheck)
PaymentForm ( Payment paycheck)
Angius
Angius4w 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
Davo4w 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
Angius4w ago
You already have my answer It's not likely to change
Davo
Davo4w ago
okayy
Want results from more Discord servers?
Add your server