Convert IQueryable list to generic list?
I am trying to call GetScanningLogOnSettings()
that queries a table ScanningDepartments
to get the departments, then instantiate ApplicationLogOnModel
, assign the requested results to a variable in ApplicationLogOnModel
and return the result.
private ApplicationLogOnModel GetScanningLogOnSettings()
{
var mesEntity = new MESEntities();
var departments = from dept in mesEntity.ScanningDepartments
select dept.Department.ToList();
ApplicationLogOnModel depts = new ApplicationLogOnModel()
{
Department = departments
};
return depts;
}
This gives me:
"Can not implicitly convert type
'System.Linq.IQueryable<System.Collections.Generic.List<char>>
to'System.Collections.Generic.List<Models.Department>'
Tried converting to lists and I have a little problem.
+3
source to share