✅ JSON + ASP.NET attribute usage
Hi! My JSON class looks like this:
It works just fine.
An issue occurs whenever I got code like this:
Binding the model fails now (because the constructor of
Car
is throwing an exception) which results in an HTTP status code 500 (Internal Server Error) instead of my desired 400 (Bad Request).
My current idea (I don't like it): Create a copy of that class without the JSON attributes but with DataAnnotations.
Do you have any other ideas?
Thanks in advance!2 Replies