public static IRuleBuilderOptions <T, string> IsCurrentResponse <T>(this IRuleBuilder <T, string> rule, ResponseForm instance) { return(rule.Must(id => { using (var db = new MongoDbContext()) { var response = db.GetResponseById(id); if (response != null) { // verify the current timestamps match if (instance.Current.On == response.Current.On) { return true; } } } return false; })); }
public ValidationResult Validate(AccountSession accountSession, ValidationMode validationMode, ResponseForm instance) { return((new ResponseFormValidator(accountSession, validationMode, instance)).Validate(this) as ValidationResult); }