C
C#2y ago
tigey

❔ ASP.NET Core Web API controller method parameter is not null, but property values are always null.

I have a method on a controller that takes a model class as a parameter. Calling the method from an old AngularJS application via an AJAX call with a payload that matches the structure of the model class. Breakpointing on the first line of the method I can see that an instance of the model class is materialized, but none of the properties have values.
4 Replies
tigey
tigeyOP2y ago
Looks like it had to do with how I was passing the payload data into the AJAX call.
tigey
tigeyOP2y ago
tigey
tigeyOP2y ago
Previously one could get away with having the data property set to something like {tripRequest: payload} and it would be fine, but in ASP.NET Core it did not like that. Either way, it work now.
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server