ASP.NET Core 2 – Global Model validation

added by DotNetKicks
2/26/2018 2:03:49 PM

2 Kicks, 261 Views

We use a lot of repetitive code in our actions. Inside of our controller actions we usually check if the model is valid by using ModelState property available on MVC's base controller class: View the code on Gist. The bad thing about is that we repeat this piece of code throughout a lot of our actions.