Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save NTCoding/3914569 to your computer and use it in GitHub Desktop.
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