public List <LessonsInfo> List() { using (var _dbContext = new simpleDbContext()) { return(_dbContext.LessonsInfo.AsNoTracking().ToList()); } }
public List <LessonsInfo> List(Expression <Func <LessonsInfo, bool> > predicate) { using (var _dbContext = new simpleDbContext()) { return(_dbContext.LessonsInfo.AsNoTracking().Where(predicate).ToList()); } }
public List <Teachers> List() { using (var _dbContext = new simpleDbContext()) { return(_dbContext.Teachers.AsNoTracking().ToList()); } }
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()); } }
public List <Teachers> List(Expression <Func <Teachers, bool> > predicate) { using (var _dbContext = new simpleDbContext()) { return(_dbContext.Teachers.AsNoTracking().Where(predicate).ToList()); } }
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()); } }
public bool Update(LessonsInfo entity) { using (var _dbContext = new simpleDbContext()) { _dbContext.LessonsInfo.AddOrUpdate(entity); return(_dbContext.SaveChanges() > 0); } }
public bool Delete(int lessonId, int teacherId) { using (var _dbContext = new simpleDbContext()) { _dbContext.LessonsInfo.Remove(Get(lessonId, teacherId)); return(_dbContext.SaveChanges() > 0); } }
public bool Update(Teachers entity) { using (var _dbContext = new simpleDbContext()) { _dbContext.Teachers.AddOrUpdate(entity); return(_dbContext.SaveChanges() > 0); } }
public bool Delete(int id) { using (var _dbContext = new simpleDbContext()) { _dbContext.Teachers.Remove(Get(id)); return(_dbContext.SaveChanges() > 0); } }
public LessonsInfo Create(LessonsInfo entity) { using (var _dbContext = new simpleDbContext()) { _dbContext.LessonsInfo.Add(entity); _dbContext.SaveChanges(); return(entity); } }
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); } }