public ActionResult DeleteGroup(string GroupName)
 {
     GroupDAO groupDAO = new GroupDAO();
     ModelContainer data = new Models.ModelContainer();
     Res result = groupDAO.DeleteGroup(x => (x.GroupName == GroupName), data);
     if (result.Success)
         return RedirectToAction("Groups", "Admin");
     else return RedirectToAction("Errors", "Shared");
 }
 public ActionResult CreateStudentRequest(string GroupName)
 {
     ModelContainer data = new ModelContainer();
     StudentRequestDAO studentrequestdao = new StudentRequestDAO();
     UserDAO userdao = new UserDAO();
     GroupDAO groupdao = new GroupDAO();
     IEnumerable<aspnet_Users> users = (IEnumerable<aspnet_Users>)(userdao.ReadAll(x => (x.LoweredUserName == User.Identity.Name.ToLower()), data).Value);
     IEnumerable<Group> groups = (IEnumerable<Group>)(groupdao.ReadAll(x => (x.GroupName == GroupName), data).Value);
     Res result = studentrequestdao.CreateRequest(users.First(x => true), groups.First(x => true), data);
         return RedirectToAction("CreateStudentRequestView", "Student");
 }
        public ActionResult BindGroupAndTest(string TestId, string GroupId)
        {
            ModelContainer data = new ModelContainer();
            Test.Models.DAO.TestDAO tdao = new Models.DAO.TestDAO();
            Test.Models.GroupDAO gdao = new GroupDAO();

            Group g = (gdao.ReadAll(x => x.GroupId.ToString() == GroupId, data).Value as IEnumerable<Group>).First();
            Models.Test t = (tdao.ReadTests(x => x.TestId.ToString() == TestId, data).Value as IEnumerable<Models.Test>).First();

            tdao.Bind(t, g, data);

            return RedirectToAction("GroupsAndTests", "Lector");
        }
 public ActionResult Groups()
 {
     ViewData["links"] = getLinks();
     ViewData["functions"] = getFunctions();
     GroupDAO groupdao = new GroupDAO();
     ModelContainer data = new Models.ModelContainer();
     Res result = groupdao.ReadAll(x => (true), data);
     if (result.Success)
         return View(result.Value);
     else return RedirectToAction("Errors", "Shared");
 }
 public ActionResult UpdateGroup(string NewGroupName, string OldGroupName)
 {
     ViewData["links"] = getLinks();
     ViewData["functions"] = getFunctions();
     GroupDAO groupDAO = new GroupDAO();
     ModelContainer data = new Models.ModelContainer();
     Res result = groupDAO.UpdateGroup(NewGroupName, OldGroupName, data);
     if (result.Success)
         return RedirectToAction("Groups", "Admin");
     else return RedirectToAction("Errors", "Shared");
 }
 public ActionResult GroupsAndTests()
 {
     ViewData["links"] = getLinks();
     ViewData["functions"] = getFunctions();
     ModelContainer data = new ModelContainer();
     Test.Models.DAO.TestDAO tdao = new Models.DAO.TestDAO();
     Test.Models.GroupDAO gdao = new GroupDAO();
     Res rt = tdao.ReadTests(test => test.Discipline.aspnet_Users.LoweredUserName == User.Identity.Name.ToLower(), data);
     Res gr = gdao.ReadAll(group => true, data);
     return View(new object[] { rt.Value , gr.Value });
 }
 public ActionResult Tests()
 {
     ViewData["links"] = getLinks();
     ViewData["functions"] = getFunctions();
     ModelContainer data = new Models.ModelContainer();
     GroupDAO gdao = new GroupDAO();
     Test.Models.DAO.TestDAO tdao = new Models.DAO.TestDAO();
     UserDAO udao = new UserDAO();
     IEnumerable<aspnet_Users> users = (udao.ReadAll(x => x.LoweredUserName == User.Identity.Name.ToLower(), data).Value as IEnumerable<aspnet_Users>);
     IEnumerable<Group> groups = (gdao.ReadAll(x => x.aspnet_Users.Contains(users.First()), data).Value as IEnumerable<Group>);
     IEnumerable<Test.Models.Test> tests = (tdao.ReadTests(x => x.Groups.Contains(groups.First()), data).Value as IEnumerable<Models.Test>);
     return View(tests);
 }