Skip to content

Instantly share code, notes, and snippets.

@NTCoding
Created October 18, 2012 20:45
Show Gist options
  • Select an option

  • Save NTCoding/3914607 to your computer and use it in GitHub Desktop.

Select an option

Save NTCoding/3914607 to your computer and use it in GitHub Desktop.
public class JobsFinder<TJobFinder, TModel> where TJobFinder : ICommonJobFinder
where TModel : ICommonJobsModel, new()
{
private readonly IAllJobsFinder allJobsFinder;
private readonly TJobFinder specificJobFinder;
public JobsFinder(IAllJobsFinder allJobsFinder, TJobFinder specificJobFinder)
{
this.allJobsFinder = allJobsFinder;
this.specificJobFinder = specificJobFinder;
}
public TModel GetJobsModel(int week)
{
var specifiJobs = specificJobFinder.GetJobs(week);
var model = new TModel {Jobs = specifiJobs};
if (!specifiJobs.Any())
{
model.Jobs = allJobsFinder.GetThisWeeks(week);
model.ContainsNonSpecificJobs = true;
}
return model;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment