public Turma GetById(int id, CaseElevaEntities context = null) { if (context == null) { context = DBFactory.GetInstance().GetDb(); } return(context.Turma.FirstOrDefault(x => x.Id == id)); }
public List <Turma> GetByEscolaIds(int[] ids, CaseElevaEntities context = null) { if (context == null) { context = DBFactory.GetInstance().GetDb(); } return(context.Turma.Where(x => ids.Contains(x.EscolaId)).ToList()); }
public List <Aluno> GetByIds(int[] ids, CaseElevaEntities context = null) { if (context == null) { context = DBFactory.GetInstance().GetDb(); } return(context.Aluno.Where(x => ids.Contains(x.Id)).ToList()); }
public void DeleteByEscolaIds(int[] ids, CaseElevaEntities context = null, bool isToSaveContext = true) { if (context == null) { context = DBFactory.GetInstance().GetDb(); } List <Turma> Turmas = GetByEscolaIds(ids, context); context.Turma.RemoveRange(Turmas); if (isToSaveContext) { context.SaveChanges(); } }