Created
October 18, 2012 20:42
-
-
Save NTCoding/3914583 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 EnglishJobsHandler | |
| { | |
| private readonly IEnglishJobsFinder englishJobsFinder; | |
| private readonly IAllJobsFinder allJobsFinder; | |
| public EnglishJobsHandler(IEnglishJobsFinder englishJobsFinder, IAllJobsFinder allJobsFinder) | |
| { | |
| this.englishJobsFinder = englishJobsFinder; | |
| this.allJobsFinder = allJobsFinder; | |
| } | |
| public EnglishJobsViewModel Get(EnglishJobsRequestModel input) | |
| { | |
| var englishJobs = englishJobsFinder.GetThisWeeks(input.Week); | |
| var model = new EnglishJobsViewModel {Jobs = englishJobs}; | |
| if (!englishJobs.Any()) | |
| { | |
| model.Jobs = allJobsFinder.GetThisWeeks(input.Week); | |
| model.ContainsNonEnglishJobs = true; | |
| } | |
| return model; | |
| } | |
| } | |
| public class FrenchJobsHandler | |
| { | |
| private readonly IFrenchJobsFinder frenchJobsFinder; | |
| private readonly IAllJobsFinder allJobsFinder; | |
| public FrenchJobsHandler(IAllJobsFinder allJobsFinder, IFrenchJobsFinder frenchJobsFinder) | |
| { | |
| this.allJobsFinder = allJobsFinder; | |
| this.frenchJobsFinder = frenchJobsFinder; | |
| } | |
| public FrenchJobsViewModel Get(FrenchJobsRequestModel input) | |
| { | |
| var frenchJobs = frenchJobsFinder.GetThisWeeks(input.Week); | |
| var model = new FrenchJobsViewModel{Jobs = frenchJobs}; | |
| if (frenchJobs.Any()) | |
| { | |
| model.Jobs = allJobsFinder.GetThisWeeks(input.Week); | |
| model.ContainsNonFrenchJobs = true; | |
| } | |
| return model; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment