I have a LinQ To Entities Query,
And an ActivityModel returns to me, but it really does the query to the Activity entity, and I assign each data as you can see it, but it brings me the Orders as Icollection<Orden>
, and in ActivityModel I have it as ICollection<OrdenModel>
What can I do to convert it ?, with the best possible practice, and if you can improve the code it would be fine thank you!
var result = (from a in ctx.Actividad
join e in ctx.Empleado on a.IdEmpleado equals e.IdEmpleado
where a.IdEstimacion == id
select new ActivityModel()
{
Responsable = e.Nombre,
IdEmpleado = a.IdEmpleado,
IdActividad = a.IdActividad,
IdEstimacion = a.IdEstimacion,
OrdenModels = a.Ordenes,
Nombre = a.Nombre,
FechaFinal = a.FechaFinal,
FechaInicial = a.FechaInicial,
HorasPresupuestadas = a.HorasPresupuestadas
}).ToList();