private IEnumerable <TrainingCourseView> GetCourseViews(Expression <Func <TrainingCourse, bool> > whereClause, DateTime when)
 {
     return(db.TrainingCourses
            .Where(whereClause)
            .OrderBy(f => f.DisplayName)
            .Select(TrainingCourseView.GetTrainingCourseConversion(when)));
 }
 public TrainingCourseView Get(Guid id)
 {
     // Get the data object (if it exists), and pass it through a conversion to the view model. If it doesn't exist, throw a 404 exception
     return(GetObjectOrNotFound(
                () => db.TrainingCourses
                .Where(f => f.Id == id)
                .Select(TrainingCourseView.GetTrainingCourseConversion(DateTime.Now))
                .SingleOrDefault()));
 }