public static listaMaterias Materias() { listaMaterias response = new listaMaterias(); using (var db = new MyDbContext()) { response.Subjects = db.Subject.ToList(); } return(response); }
public static listaMaterias Materias() { listaMaterias listaretorno = new listaMaterias(); listaretorno = MateriaDataAccess.Materias(); if ((Person)HttpContext.Current.Session["Usuario"] is Alumn) { Alumn alumno = MateriaDataAccess.getAlumno(((Person)HttpContext.Current.Session["Usuario"]).Id); var filterList = listaretorno.Subjects.Where(x => !alumno.Subjects.Any(y => y.Id == x.Id)); listaretorno.Subjects = filterList.OrderBy(x => x.name); } return(listaretorno); }