Example #1
0
        public Turma GetById(int id, CaseElevaEntities context = null)
        {
            if (context == null)
            {
                context = DBFactory.GetInstance().GetDb();
            }

            return(context.Turma.FirstOrDefault(x => x.Id == id));
        }
Example #2
0
        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());
        }
Example #3
0
        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());
        }
Example #4
0
        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();
            }
        }