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