I have a single form used to create similar items. I will simplify the scenario for demonstration.
You can create one of many "Content Types". You can choose to add a "File", "Folder", "Announcement", etc. I would use /home/addcontent?contenttype=FILE to determine what options to show in the view.
Each content item has the following.
- Name
- Description (optional)
A "File" also has:
- List item
- FilePath
An Announcement also has:
- Priority
- DisplayHomepageFLG (optional)
I could add all of these to one viewmodel with all of the data annotations but modelstate.isvalid would almost never be true since each "content type" has unique properties.
Is there some programatic way to add or exclude specific data annotations or should I have a separate viewmodel and controller for each content type?