In my first question I didn't explain well. But now I need to select some columns from a entity framework class.
var Muestra = Cecytec.asignatura.Select(Z => new asignatura { nombre = Z.nombre, horasPorSemana = Z.horasPorSemana, nivel = Z.nivel, unidades = Z.unidades }).ToList();
From my class(table) "asignatura" I have this:
public partial class asignatura
{
public asignatura()
{
this.criterioevaluacion = new HashSet<criterioevaluacion>();
this.evaluacion = new HashSet<evaluacion>();
this.examen = new HashSet<examen>();
this.alumno = new HashSet<alumno>();
this.horario = new HashSet<horario>();
this.profesor = new HashSet<profesor>();
}
public int idAsignatura { get; set; }
public Nullable<int> horasPorSemana { get; set; }
public string nombre { get; set; }
public Nullable<int> nivel { get; set; }
public Nullable<int> unidades { get; set; }
public int semestres_idsemestres { get; set; }
public virtual semestres semestres { get; set; }
public virtual ICollection<criterioevaluacion> criterioevaluacion { get; set; }
public virtual ICollection<evaluacion> evaluacion { get; set; }
public virtual ICollection<examen> examen { get; set; }
public virtual ICollection<alumno> alumno { get; set; }
public virtual ICollection<horario> horario { get; set; }
public virtual ICollection<profesor> profesor { get; set; }
}
And I want to show: 'nombre', 'horasPorSemana', 'nivel', 'unidades' and 'calificacion'
Note: 'calificacion' is in another class
public partial class evaluacion
{
public int unidad { get; set; }
public Nullable<double> calificacion { get; set; }
public Nullable<int> inasistencia { get; set; }
public string observaciones { get; set; }
public int asignatura_idAsignatura { get; set; }
public virtual asignatura asignatura { get; set; }
}