Created
October 18, 2012 20:45
-
-
Save NTCoding/3914607 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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