Exemplo n.º 1
0
 public List <LessonsInfo> List()
 {
     using (var _dbContext = new simpleDbContext())
     {
         return(_dbContext.LessonsInfo.AsNoTracking().ToList());
     }
 }
Exemplo n.º 2
0
 public List <LessonsInfo> List(Expression <Func <LessonsInfo, bool> > predicate)
 {
     using (var _dbContext = new simpleDbContext())
     {
         return(_dbContext.LessonsInfo.AsNoTracking().Where(predicate).ToList());
     }
 }
Exemplo n.º 3
0
 public List <Teachers> List()
 {
     using (var _dbContext = new simpleDbContext())
     {
         return(_dbContext.Teachers.AsNoTracking().ToList());
     }
 }
Exemplo n.º 4
0
 public LessonsInfo Get(int lessonId, int teacherId)
 {
     using (var _dbContext = new simpleDbContext())
     {
         return(_dbContext.LessonsInfo.AsNoTracking().Where(l => l.LessonId == lessonId && l.TeacherId == teacherId).FirstOrDefault());
     }
 }
Exemplo n.º 5
0
 public List <Teachers> List(Expression <Func <Teachers, bool> > predicate)
 {
     using (var _dbContext = new simpleDbContext())
     {
         return(_dbContext.Teachers.AsNoTracking().Where(predicate).ToList());
     }
 }
Exemplo n.º 6
0
 public Teachers Get(int id)
 {
     using (var _dbContext = new simpleDbContext())
     {
         return(_dbContext.Teachers.AsNoTracking().Where(l => l.Id == id).FirstOrDefault());
     }
 }
 public List <Students> List()
 {
     using (var _dbContext = new simpleDbContext())
     {
         return(_dbContext.Students.AsNoTracking().ToList());
     }
 }
Exemplo n.º 8
0
 public bool Update(LessonsInfo entity)
 {
     using (var _dbContext = new simpleDbContext())
     {
         _dbContext.LessonsInfo.AddOrUpdate(entity);
         return(_dbContext.SaveChanges() > 0);
     }
 }
Exemplo n.º 9
0
 public bool Delete(int lessonId, int teacherId)
 {
     using (var _dbContext = new simpleDbContext())
     {
         _dbContext.LessonsInfo.Remove(Get(lessonId, teacherId));
         return(_dbContext.SaveChanges() > 0);
     }
 }
Exemplo n.º 10
0
 public bool Update(Teachers entity)
 {
     using (var _dbContext = new simpleDbContext())
     {
         _dbContext.Teachers.AddOrUpdate(entity);
         return(_dbContext.SaveChanges() > 0);
     }
 }
Exemplo n.º 11
0
 public bool Delete(int id)
 {
     using (var _dbContext = new simpleDbContext())
     {
         _dbContext.Teachers.Remove(Get(id));
         return(_dbContext.SaveChanges() > 0);
     }
 }
Exemplo n.º 12
0
 public LessonsInfo Create(LessonsInfo entity)
 {
     using (var _dbContext = new simpleDbContext())
     {
         _dbContext.LessonsInfo.Add(entity);
         _dbContext.SaveChanges();
         return(entity);
     }
 }
Exemplo n.º 13
0
 public Teachers Create(Teachers entity)
 {
     using (var _dbContext = new simpleDbContext())
     {
         _dbContext.Teachers.Add(entity);
         _dbContext.SaveChanges();
         return(entity);
     }
 }
 public Students Create(Students entity)
 {
     using (var _dbContext = new simpleDbContext())
     {
         _dbContext.Students.Add(entity);
         _dbContext.SaveChanges();
         return(entity);
     }
 }