The problem here isn't that you need to convert from List
to IEnumerable
.
The problem is that you're trying to convert from List<tblSoftwareImageTestPlan>
to IEnumerable<SoftwareImageTestPlan>
Those are two completely different types, because of the type argument.
Possible solutions:
- Change the return type to
IEnumerable<tblSoftwareImageTestPlan>
Map the objects to
SoftwareImageTestPlan
by projecting thetblSoftwareImageTestPlan
to aSoftwareImageTestPlan
:public IEnumerable<SoftwareImageTestPlan> GetAssignedTestPlansForSPSI(int softwareProductID, int SoftwareImageID) { var records = _entities.tblSoftwareImageTestPlans .Where(x => x.SoftwareProductID == SoftwareProductID && x.SoftwareImageID == SoftwareImageID) .Select(x => new SoftwareTestPlan { Id = Id, // example ... do more mapping here }) .ToList(); if (records == null) return new List<SoftwareImageTestPlan>(); else return records; }