I have a page with which i post two view models to the controller, Enquiry and Appointment. Appointment is nested within enquiry. A user can choose to submit an enquiry with our without creating an appointment .
I use the built in MVC required attributes on the view model properties.
My question is, when the user chooses to create an enquiry without an appointment, how can I elegantly ignore the validators on the nested Appointment view model and have ModelState.IsValid return true?
if(!viewModel.CreateAppointment)
{
//ignore the nested view models validation
}