public IQueryable <Goal> Where(Expression <Func <Goal, bool> > predicate) { using (ExaminationContext db = new ExaminationContext()) { return(db.Goals.Where(predicate)); } }
public Goal GetById(Guid id) { using (ExaminationContext db = new ExaminationContext()) { return(db.Goals.FirstOrDefault(g => g.Id == id)); } }
public IQueryable <Goal> GetGoalsOfLesson(Guid lessonId) { using (ExaminationContext db = new ExaminationContext()) { return(db.Goals.Where(g => g.LessonId == lessonId)); } }
public void Add(Goal entity) { using (ExaminationContext db = new ExaminationContext()) { db.Goals.Add(entity); db.SaveChanges(); } }
public void Delete(Goal entity) { using (ExaminationContext db = new ExaminationContext()) { var goal = GetById(entity.Id); db.Goals.Remove(goal); db.SaveChanges(); } }
public StudentRepository() { examinationContext = new ExaminationContext(); }