Closed jonhilt closed 3 years ago
Thanks @jonhilt.
Look forward to reviewing this evening. Might even drop a refactoring video! 😊
Hi @jonhilt
Works great and I confirmed that the validation was being applied both from the form and the api.
Unrelated to the fluent validation I updated the Min, Max and Step attributes of the Hours field in order to allow decimals to be entered.
This validation works on both the client and the API, using the exact same validator.
This has the advantage that initial validation is nice and snappy because it's performed on the client, but even if someone bypassed that (somehow by mistake, or in a deliberate attempt to bypass the validation) the API will apply the same rules.
I implemented an action filter in the API so there's no need to check ModelState in every controller action, the filter will do this automatically for all requests.