I have a custom validation method defined in a class called SignUpModelValidation. The validation method needs access to my ICourseService. Is there a way to have Orchard inject that dependency to the validation? Or is the better way to just include ALL
necessary fields for validation on the actual object being validated?
For instance, have a view mode (SignUpViewModel)l with a CoursePart property and a NumberOfAttendees property.
I have ICourseService that can return the current number of registrations for a course.
In my validatio I need to check if
NumberOfAttendees <= CoursePart.TotalSeats - courseService.GetNumberOfRegistrations()
But, since validation methods are static and static classes can't have instance constructors I'm not sure how to cleanly get ICourseService injected to the validator.
Maybe just adding an OpenSeats property to the view model is the better way?