I'm using NHibernate and I've got a Campaign
class and it has a Client
class as one of its members and I'm attempting to use ModelState.IsValid
in my [HttpPost] public Create (CreateCampaignViewModel vm)
method.
As my ViewModel contains the object Campaign
ModelStats.IsValid
is always false as I'm passing the Client.Id
from the form instead of the entire Client
object.
Is there a way to have it load the Client member before it runs the validation code that sets ModelState.IsValid
? Or is there a way to refresh the state of ModelState
after I 'manually' retrieve the client object based on the ClientId and bind it to the Campaign?