public ActionResult CreateDiscipline(string Name)
 {
     ViewData["links"] = getLinks();
     ViewData["functions"] = getFunctions();
     ModelContainer data = new ModelContainer();
     DisciplineDAO disciplineDAO = new DisciplineDAO();
     UserDAO userDAO = new UserDAO();
     IEnumerable<aspnet_Users> users = (IEnumerable<aspnet_Users>)userDAO.ReadAll(x => (x.LoweredUserName == User.Identity.Name.ToLower()), data).Value;
     Res result = disciplineDAO.CreateDiscipline(Name, users.First(x => (x.LoweredUserName == User.Identity.Name.ToLower())), data);
     return RedirectToAction("Disciplines", "Lector");
 }
 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 UpdateDiscipline(string NewName, string OldName)
 {
     ViewData["links"] = getLinks();
     ViewData["functions"] = getFunctions();
     ModelContainer data = new ModelContainer();
     DisciplineDAO disciplineDAO = new DisciplineDAO();
     disciplineDAO.RenameDiscipline(NewName, OldName, data);
     return RedirectToAction("Disciplines", "Lector");
 }
 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);
 }