private IEnumerable <Student> GetStudents(int groupId, string searchString, LmPlatformRepositoriesContainer repositoriesContainer) { var studentsQuery = new Query <Student>(); studentsQuery.AddFilterClause(student => student.GroupId == groupId); if (searchString != null) { studentsQuery.AddFilterClause(student => student.LastName.Contains(searchString) || student.FirstName.Contains(searchString)); } IQueryable <Student> students = repositoriesContainer.StudentsRepository.GetAll(studentsQuery); return(students); }
public IEnumerable <Question> GetQuestionsForTest(int testId, string searchString = null) { IEnumerable <Question> searchResults; using (var repositoriesContainer = new LmPlatformRepositoriesContainer()) { var query = new Query <Question>(); if (testId != 0) { query.AddFilterClause(question => question.TestId == testId); } if (searchString != null) { query.AddFilterClause(question => question.Title.Contains(searchString)); } searchResults = repositoriesContainer.QuestionsRepository.GetAll(query).ToList(); } return(searchResults); }
public IList <Question> GetQuestionsByConceptId(int conceptId) { IList <Question> searchResults; using (var repositoriesContainer = new LmPlatformRepositoriesContainer()) { var query = new Query <Question>(); query.AddFilterClause(question => question.ConceptId == conceptId); searchResults = repositoriesContainer.QuestionsRepository.GetAll(query).ToList(); } return(searchResults); }
public IEnumerable <Test> GetTestForLector(int currentUserId) { IEnumerable <Test> searchResults; using (var repositoriesContainer = new LmPlatformRepositoriesContainer()) { var query = new Query <Test>(); query.AddFilterClause(test => test.Subject.SubjectLecturers.Any(sl => sl.LecturerId == currentUserId)); searchResults = repositoriesContainer.TestsRepository.GetAll(query).ToList(); } return(searchResults); }
public IEnumerable <Question> GetQuestionsFromAnotherTests(int testId, int currentUserId) { IEnumerable <Question> searchResults; using (var repositoriesContainer = new LmPlatformRepositoriesContainer()) { var query = new Query <Question>(); if (testId == 0) { query.AddFilterClause( question => question.Test.Subject.SubjectLecturers.Any(sl => sl.LecturerId == currentUserId)); } else { query.AddFilterClause( question => question.TestId == testId); } searchResults = repositoriesContainer.QuestionsRepository.GetAll(query).ToList(); } return(searchResults); }
public IEnumerable <Test> GetTestsForSubject(int?subjectId) { IEnumerable <Test> searchResults; using (var repositoriesContainer = new LmPlatformRepositoriesContainer()) { var query = new Query <Test>().Include(test => test.TestUnlocks); if (subjectId.HasValue) { query.AddFilterClause(test => test.SubjectId == subjectId.Value); query.Include(t => t.Questions); } searchResults = repositoriesContainer.TestsRepository.GetAll(query).ToList(); } return(searchResults); }
public IEnumerable<Question> GetQuestionsForTest(int testId, string searchString = null) { IEnumerable<Question> searchResults; using (var repositoriesContainer = new LmPlatformRepositoriesContainer()) { var query = new Query<Question>(); if (testId != 0) { query.AddFilterClause(question => question.TestId == testId); } if (searchString != null) { query.AddFilterClause(question => question.Title.Contains(searchString)); } searchResults = repositoriesContainer.QuestionsRepository.GetAll(query).ToList(); } return searchResults; }
private IEnumerable<Student> GetStudents(int groupId, string searchString, LmPlatformRepositoriesContainer repositoriesContainer) { var studentsQuery = new Query<Student>(); studentsQuery.AddFilterClause(student => student.GroupId == groupId); if (searchString != null) { studentsQuery.AddFilterClause(student => student.LastName.Contains(searchString) || student.FirstName.Contains(searchString)); } IQueryable<Student> students = repositoriesContainer.StudentsRepository.GetAll(studentsQuery); return students; }
public IEnumerable<Question> GetQuestionsFromAnotherTests(int testId, int currentUserId) { IEnumerable<Question> searchResults; using (var repositoriesContainer = new LmPlatformRepositoriesContainer()) { var query = new Query<Question>(); if (testId == 0) { query.AddFilterClause( question => question.Test.Subject.SubjectLecturers.Any(sl => sl.LecturerId == currentUserId)); } else { query.AddFilterClause( question => question.TestId == testId); } searchResults = repositoriesContainer.QuestionsRepository.GetAll(query).ToList(); } return searchResults; }
public IEnumerable<Test> GetTestForLector(int currentUserId) { IEnumerable<Test> searchResults; using (var repositoriesContainer = new LmPlatformRepositoriesContainer()) { var query = new Query<Test>(); query.AddFilterClause(test => test.Subject.SubjectLecturers.Any(sl => sl.LecturerId == currentUserId)); searchResults = repositoriesContainer.TestsRepository.GetAll(query).ToList(); } return searchResults; }
public IEnumerable<Test> GetTestsForSubject(int? subjectId) { IEnumerable<Test> searchResults; using (var repositoriesContainer = new LmPlatformRepositoriesContainer()) { var query = new Query<Test>().Include(test => test.TestUnlocks); if (subjectId.HasValue) { query.AddFilterClause(test => test.SubjectId == subjectId.Value); query.Include(t => t.Questions); } searchResults = repositoriesContainer.TestsRepository.GetAll(query).ToList(); } return searchResults; }