I have a peculiar scenario in which i need to validate an object that isn't my model and get all the ValidationResult objects from it.
So my controller has something like this in it ...
public virtual ActionResult(MyObject postData)
{
ICollection someCollection = DoSomething(postData);
foreach(Thing t in someCollection)
{
// validate t and get any ValidationResult objects
// put the validation results in the object property.
// this call isn't real by the way
t.ValidationResults = t.Validate();
}
...
}
Its not my model i'm validating but based on the postdata i'm given i need to validate the collection and where the validation fails I plan to render the failed objects in the collection.
any ideas how I can the ValidationResult objects I want?