I want to build a linq query by applying group by but I have an extended class in which I have to match the feature class with the extended class.
IEnumerable<ModeloExtend> result = Context.Modelos
.Where(x => x.LineaId == damas || x.LineaId == caballeros)
.GroupBy(x => x.LineaId)
.Select(g => new ModeloExtend
{
ModeloExtendId = g.Key,
Descripcion = g.ElementAt()
}).ToList();
I can not make the new selection
I want to do this but with GROUP BY eliminating the ORDER BY
List<ModeloExtend> result = Context.Modelos
.Where(x => x.LineaId == damas || x.LineaId == caballeros)
.OrderBy(x => x.LineaId)
.Select(x => new ModeloExtend
{
ModeloExtendId = x.ModeloId,
Descripcion = x.Descripcion
}).ToList();