コード例 #1
0
 public ActionResult LoadStudentAttendance(LoadStudentsViewModel model)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(View());
         }
         HttpCookie conString = Request.Cookies.Get("rwxgqlb");
         Section    section   = new Section(model.Section, Cryptography.Decrypt(conString.Value));
         List <ViewStudentAttendanceViewModel> lstStudents = new List <ViewStudentAttendanceViewModel>();
         foreach (var item in section.GetStudents())
         {
             lstStudents.Add(new ViewStudentAttendanceViewModel
             {
                 Id       = item.StudentId,
                 IsAbsent = item.GetAbsentStatus(DateTime.Now),
                 Name     = item.Name,
                 RollNo   = item.RollNumber
             });
         }
         if (lstStudents.Count == 0)
         {
             ViewBag.Empty = true;
         }
         ViewBag.SectionId = model.Section;
         return(View("ViewStudentAttendance", lstStudents));
     }
     catch (Exception ex)
     {
         return(Content(ex.Message));
     }
 }
コード例 #2
0
 public ActionResult LoadStudentsToPromote(LoadStudentsViewModel model)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(View());
         }
         return(RedirectToAction("ViewStudentsToPromote", new { secId = model.Section }));
     }
     catch (Exception ex)
     {
         return(Content(ex.Message));
     }
 }
コード例 #3
0
 public ActionResult PromoteToSection(LoadStudentsViewModel model)
 {
     try
     {
         HttpCookie conString   = Request.Cookies.Get("rwxgqlb");
         List <int> lstStudents = (List <int>)TempData["StudentIdToPromote"];
         TempData.Remove("StudentIdToPromote");
         foreach (var id in lstStudents)
         {
             Student s = new Student(id, Cryptography.Decrypt(conString.Value));
             s.Section = new Section(model.Section, Cryptography.Decrypt(conString.Value));
         }
         return(RedirectToAction("LoadStudentsToPromote", new { s = true }));
     }
     catch (Exception)
     {
         return(RedirectToAction("ViewStudentsToPromote", new { err = true }));
     }
 }