Ejemplo n.º 1
0
        public async Task <IActionResult> StudentTests(string sq, bool rOnly, bool dOnly = true, bool tOnly = true)
        {
            TestSearch sp = new TestSearch(sq, dOnly, tOnly, rOnly, mainDb, Student);

            var result = await mainDb.Tests
                         .Where(t => sp.GetPredicateForStudent()(t))
                         .ToListAsync();

            return(View(result));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> TeacherTests(string sq, bool rOnly, bool dOnly = true, bool tOnly = true)
        {
            TestSearch sp = new TestSearch(sq, dOnly, tOnly, rOnly, mainDb);

            var result = await mainDb.Tests.Where(t => Teacher.Disciplines
                                                  .Select(d => d.Abbr).Contains(t.Abbr) && sp.GetPredicateForTeacher()(t))
                         .ToListAsync();

            return(View(result));
        }