I am a beginner to use linq and i have a problem with this code when i use IEnumerable it return data but with IQueryable it doesn't and i don't know why ,, and another question how when using IEnumerable it return data without using functions like ToList().
public IQueryable<TempDTO> GetAllWorkers()
{
var query = (from q in _context.X
select new TempDTO
{
id=q.id,
.
.
.
Machines = GetMachinesListById(q.Id)
});
return query;
}
private IEnumerable<Temp2DTO> GetMachinesListById(int? id){ // return query with machines}
And this is my api
public IActionResult GetAllWorkers()
{
var result = _Repo.GetAllWorkers().Where(// condition);
return Ok(result);
}
Thanks in advance.