-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathQuestion3.cs
More file actions
30 lines (25 loc) · 891 Bytes
/
Question3.cs
File metadata and controls
30 lines (25 loc) · 891 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using Example.Interview.Question.Placeholders;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace csharp_interview
{
internal class Question3
{
private readonly ICompanyRepository _companyRepository;
public Question3(ICompanyRepository companyRepository)
{
_companyRepository = companyRepository;
}
public IEnumerable<PersonEntity> FindEmployees(string companySynonim)
{
var result = new List<PersonEntity>();
var companies = _companyRepository.FindCompaniesWithMatchingSynonims(companySynonim);
Parallel.ForEach(companies, company =>
{
var employees = _companyRepository.FindEmployeesOfCompany(company.Id);
result.AddRange(employees);
});
return result;
}
}
}