I am using Asp.net MVC4. I am having some entities and some rules for each entity which i need to validate from controller and display the curresponding error messages. I am trying to design a common validation class which can be used for all the entities that i am using. If I call the validation it should return me validation success or list of validation errors. I will be passing the entity and its type
Some sample entities and rules
Employee - Employee should have either middle name or last name
- First name, Middle name, last name should not be same
- Should have address id and it should present in address table
......
......
Address - In address line if there is an opening bracket it should have a matching closing bracket
- If user give map url and it doesnt contains "http://" should show error message
.......
.......
I am having all the error message in a resource file with the error type id
Please advice me on which approch i should follow? or Share me some web tutorial link which will help me to design this