You're returning two different object types:
- tblSoftwareImageTestPlan - Which resides in your Entity Framework model
- SoftwareImageTestPlan - Which resides in your Qlasr Schema Models
Therefore when you state the following:
return records;
It will complain that the records
object is not of type SoftwareImageTestPlan
. Therefore you need to convert records
into a new List<SoftwareImageTestPlan>
which you can achieve via a LINQ projection
.
var records = (from entities in _entities.tblSoftwareImageTestPlans
where entities.SoftwareProductID equals SoftwareProductID && entities.SoftwareImageID == SoftwareImageId
select new SoftwareImageTestPlan
{
SoftwareProductID = entities.SoftwareProductID,
SoftwareImageID = entities.SoftwareImageID
}).ToList();
You can then use your original statement:
if (records == null)
return new List<SoftwareImageTestPlan>();
else
return records;