コード例 #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));
        }
コード例 #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());
        }
コード例 #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());
        }
コード例 #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();
            }
        }