Is it best practice to put data validation annotations in the Model or View Model? What are the advantages/disadvantages of one approach over the other?
Curious to see w
As far as best practices is concerned I would say: in neither of them. Validation should be separate. Frameworks such as FluentValidation allow you to completely separate your validation logic from your models. But to answer your question I would put validation into View Models as those are the classes you are binding your controller actions to. You could also have multiple View Models that are tied to the same model but with different validation rules.