public bool isItJob(JobByTechnoWithCompany job) { return(job.MainTechnologies.Any(e => e != TechnologiesEnum.ChefDeProjet && e != TechnologiesEnum.Alternance) | job.SecondaryTechnologies.Any(e => e != TechnologiesEnum.ChefDeProjet && e != TechnologiesEnum.Alternance)); }
private Dictionary <string, AggregatedCompany> AggregateCompaniesAndJobs( Dictionary <string, AggregatedCompany> acc, JobByTechnoWithCompany job) { // If company does not exists and if current job contains technologies if (!acc.ContainsKey(job.Company)) { if (_technologiesService.isItJob(job)) { acc[job.Company] = new AggregatedCompany { Company = job.Company, Jobs = new Dictionary <string, JobByTechno> { { job.Title, new JobByTechno { SitesWithUrls = new Dictionary <string, string> { { job.Site, job.Url } }, MainTechnologies = job.MainTechnologies, SecondaryTechnologies = job.SecondaryTechnologies, Title = job.Title } } } } } ; } else { // If company already contains the job if (acc[job.Company].Jobs.ContainsKey(job.Title)) { foreach (var techno in job.MainTechnologies) { acc[job.Company].Jobs[job.Title].MainTechnologies.Add(techno); } foreach (var techno in job.SecondaryTechnologies) { acc[job.Company].Jobs[job.Title].SecondaryTechnologies.Add(techno); } if (!acc[job.Company].Jobs[job.Title].SitesWithUrls.ContainsKey(job.Site)) { acc[job.Company].Jobs[job.Title].SitesWithUrls[job.Site] = job.Url; } } // If company does not contains the job, and if job has technologies else if (_technologiesService.isItJob(job)) { acc[job.Company].Jobs[job.Title] = new JobByTechno { MainTechnologies = job.MainTechnologies, SecondaryTechnologies = job.SecondaryTechnologies, Title = job.Title, SitesWithUrls = new Dictionary <string, string> { { job.Site, job.Url } } }; } } return(acc); }