The following function works great if I enter one string as a parameter, but I would like to supply it a list of strings, i.e. instead of supplying it the name of one project, e.g. “AccountTracker”, I can supply it multiple project names, i.e. “AccountTracker”, “GameX”, “HR1”. How can I convert my LINQ query to do so?
There is the following relationship Employee(1–)EmployeeProjects(–1)Project
[WebGet]
public IQueryable<Employee> GetEmployeesByProjects(string project)
{
var employees = from ep in CurrentDataSource.EmployeeProjects
.Include("Project")
.Include("Employee")
where ep.Project.ProjectName == project
select ep.Employee;
return employees;
}
send the projects as string list and you can use Contains method as below
or you can send one string with projects as
"AccountTracker,GameX,HR1"