I need to convert 2 for each loops which are shown as below to linq -
List res = new List();
List result = new List();
foreach (string s in empRange)
{
List re = await _entities.Company.Where(a => Convert.ToString(a.number_employees_range.ToLower()).
Equals(s.ToLower().ToString())).ToListAsync();
res.AddRange(re);
}
foreach (Company r in res)
{
List empCount = await _entities.EmployeeCount.Where(a => Convert.ToString(a.Company_ID.ToLower()).
Equals(r.Company_id.ToLower())).
Select((a => new EmployeeCount()
{ Company_ID = a.Company_ID,
Industry_ID = a.Industry_ID, Company_Name = a.Company_Name,
City = a.City,
Number_Employees = a.Number_Employees
})).ToListAsync();
result.AddRange(empCount);
}
return result.AsQueryable();
Mageshwaran RPosted Nov 11, 2019, 10:31 AM
Rupesh KahanePosted Jul 20, 2018, 8:52 AM