public ActionResult LogDetail(int RollCallID, DateTime Date)
        {
            AttendanceBusiness AttenBO = new AttendanceBusiness();

            //1 ngay, 1 roll call co the co 2 loai log, log manual va auto, do do phai lay ca 2
            AttendanceLog AutoLog = AttenBO.GetAttendanceLogAtDate(RollCallID, Date, 1);

            AttendanceLog ManualLog = AttenBO.GetAttendanceLogAtDate(RollCallID, Date, 2);
            RollCall      RollCall  = RollBO.GetRollCallByID(RollCallID);

            LogDetailViewModel Model = new LogDetailViewModel();

            Model.RollCall  = RollCall;
            Model.AutoLog   = AutoLog;
            Model.ManualLog = ManualLog;
            return(PartialView("_LogDetail", Model));
        }
        public ActionResult Index()
        {
            //Tim instructor da dang nhạp vao
            string     Username             = this.HttpContext.User.Identity.Name;
            User       User                 = AccBO.GetUserByUsername(Username);
            Instructor AuthorizedInstructor = InsBO.GetInstructorByUserID(User.UserID);

            //Nhung mon ma instructor nay dang day, sau nay phai check status
            DateTime Today     = DateTime.Now;
            var      RollCalls = RollBO.GetInstructorCurrentRollCalls(AuthorizedInstructor.InstructorID);

            //Mon dang day vao thoi diem dang nhap
            RollCall CurrentRollCall = null;
            TimeSpan CurrentTime     = DateTime.Now.TimeOfDay;

            if (RollCalls.Count() > 0)
            {
                CurrentRollCall = RollCalls.FirstOrDefault(r => r.StartTime <CurrentTime && r.EndTime> CurrentTime);
            }

            //Neu co mon dang day, lay luon attendanlog log cua mon do
            AttendanceLog CurrentAttendanceLog = null;

            if (CurrentRollCall != null)
            {
                AttendanceBusiness AttendanceBO = new AttendanceBusiness();
                CurrentAttendanceLog = AttendanceBO.GetAttendanceLogAtDate(CurrentRollCall.RollCallID, DateTime.Today);
            }

            InstructorViewModel model = new InstructorViewModel();

            model.AuthorizedInstructor = AuthorizedInstructor;
            model.CurrentRollCall      = CurrentRollCall;
            model.TeachingRollCall     = RollCalls;
            model.CurrentAttendanceLog = CurrentAttendanceLog;
            return(View(model));
        }