public ActionResult CreateTest(string TestName, string DisciplineId)
 {
     ModelContainer data = new ModelContainer();
     Test.Models.DAO.TestDAO tdao = new Models.DAO.TestDAO();
     Test.Models.DisciplineDAO ddao = new DisciplineDAO();
     Res r1 = ddao.ReadAllDisciplines(disciline => disciline.DisciplineId.ToString() == DisciplineId, data);
     if (r1.Success)
     {
         Res r2 = tdao.CreateTests(TestName, (r1.Value as IEnumerable<Test.Models.Discipline>).First(), data);
         if (r2.Success)
         {
             return RedirectToAction("Tests", "Lector");
         }
         else
             return RedirectToAction("Errors", "Shared");
     }
     else
         return RedirectToAction("Errors", "Shared");
 }
 public ActionResult Tests()
 {
     ViewData["links"] = getLinks();
     ViewData["functions"] = getFunctions();
     Models.DAO.TestDAO tdao = new Models.DAO.TestDAO();
     DisciplineDAO disciplineDAO = new DisciplineDAO();
     ModelContainer data = new ModelContainer();
     Res r = tdao.ReadTests(test => (disciplineDAO.ReadAllDisciplines(d => d.aspnet_Users.LoweredUserName == User.Identity.Name.ToLower(), data).Value as IEnumerable<Discipline>).Contains(test.Discipline), data);
     Res result = disciplineDAO.ReadAllDisciplines(x => (x.aspnet_Users.LoweredUserName == User.Identity.Name.ToLower()), data);
     return View(new object[] {r.Value, result.Value, data.Groups});
 }
 public ActionResult Disciplines()
 {
     ViewData["links"] = getLinks();
     ViewData["functions"] = getFunctions();
     DisciplineDAO disciplineDAO = new DisciplineDAO();
     ModelContainer data = new ModelContainer();
     Res result = disciplineDAO.ReadAllDisciplines(x => (x.aspnet_Users.LoweredUserName == User.Identity.Name.ToLower()), data);
     return View(result.Value);
 }