public IQueryable <ModelStudentAnswer> GetStudentAnswersByStudentByTest(string username, int testid) { var model = new ModelStudentAnswer(); StoreQuestion questionStore = new StoreQuestion(_ctx); List <ModelQuestion> questions = questionStore.GetQuestionsByTest(testid).ToList(); List <ModelStudentAnswer> modelQuestion = model.Get(_ctx).Where(x => x.Username == username).ToList(); List <ModelStudentAnswer> final = new List <ModelStudentAnswer>(); modelQuestion.ForEach(cur => { ModelQuestion qq = questionStore.GetQuestion(cur.QuestionID); foreach (ModelQuestion curQQ in questions) { if (curQQ.QuestionID == cur.QuestionID) { final.Add(cur); } } }); return(final.AsQueryable()); }
public IQueryable <ModelStudentAnswer> GetStudentAnswersByTest(int testid) { //TODO: needs testing var model = new ModelStudentAnswer(); StoreQuestion questionStore = new StoreQuestion(_ctx); IQueryable <ModelQuestion> questions = questionStore.GetQuestionsByTest(testid); List <ModelStudentAnswer> final = new List <ModelStudentAnswer>(); model.Get(_ctx).ToList().ForEach(cur => { ModelQuestion qq = questionStore.GetQuestion(cur.QuestionID); foreach (ModelQuestion curQQ in questions) { if (curQQ.QuestionID == cur.QuestionID) { final.Add(cur); } } }); return(final.AsQueryable()); }
public IQueryable <ModelStudentAnswer> GetStudentAnswersByQuestion(int qid) { var model = new ModelStudentAnswer(); return(model.Get(_ctx).Where(x => x.QuestionID == qid)); }
public IQueryable <ModelStudentAnswer> GetStudentAnswersByStudent(string username) { var model = new ModelStudentAnswer(); return(model.Get(_ctx).Where(x => x.Username == username)); }
public ModelStudentAnswer GetStudentAnswer(int said) { var model = new ModelStudentAnswer(); return(model.Get(_ctx).FirstOrDefault(x => x.SAID == said)); }
public IQueryable <ModelStudentAnswer> ReadStudentAnswers() { var model = new ModelStudentAnswer(); return(model.Get(_ctx)); }