MVC, ViewModels, and Validation?

I too struggle with this, and I agree that it violates DRY. I posted a recent question about this Here and got quite a bit of pushback.

Personally I perform validation at view models. This is what a controller receives from a view and it is the class which contains the user input. I distinguish between two type of validation rules: surface validation and business validation.

Rules such as required fields, proper formats should be enforced at the view models whereas business rules like a user with a given name already exists in the database should be validated on the model.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions