/// <summary> /// Return the list of students with the status of logged in or out /// </summary> /// <returns></returns> // GET: Kiosk public ActionResult Index() { //TODO: Need to add a check here to validate if the request comes from a validated login or not. var myDataList = DataSourceBackend.Instance.StudentBackend.Index(); var previousDateUTC = DataSourceBackend.Instance.KioskSettingsBackend.GetLatestDate(); var previousDate = UTCConversionsBackend.UtcToKioskTime(previousDateUTC).Date; var currentDateUTC = DateTimeHelper.Instance.GetDateTimeNowUTC(); var currentDate = UTCConversionsBackend.UtcToKioskTime(currentDateUTC).Date; // Compare the current date with the last saved date from KioskSettings if (DateTime.Compare(previousDate, currentDate) != 0) //If date has changed { DataSourceBackend.Instance.StudentBackend.ResetStatusAndProcessNewAttendance(); // Save the update date back to KioskSettings DataSourceBackend.Instance.KioskSettingsBackend.UpdateLatestDate(currentDateUTC); } var myReturn = new AdminReportIndexViewModel(myDataList); return(View(myReturn)); }
public void Models_IndexViewModels_Default_Instantiate_Should_Pass() { //arrange var studentList = DataSourceBackend.Instance.StudentBackend.Index(); var expectedLeaderBoard = new List <StudentModel>(); var test = new AdminReportIndexViewModel(studentList) { //act Leaderboard = expectedLeaderBoard }; //assert Assert.AreEqual(expectedLeaderBoard, test.Leaderboard, TestContext.TestName); }
/// <summary> /// Reports /// </summary> /// <returns>All the Students that can have a report</returns> // GET: Report public ActionResult Report() { var CurrentId = DataSourceBackend.Instance.IdentityBackend.GetCurrentStudentID(HttpContext); if (DataSourceBackend.Instance.IdentityBackend.BlockExecptForRole(CurrentId, UserRoleEnum.TeacherUser)) { return(RedirectToAction("Login", "Admin")); } // Load the list of data into the StudentList var myDataList = DataSourceBackend.Instance.StudentBackend.Index(); var myReturn = new AdminReportIndexViewModel(myDataList) { Leaderboard = ReportBackend.Instance.GenerateLeaderboard() }; return(View(myReturn)); }