コード例 #1
0
        public ActionResult Index()
        {
            try
            {
                if (CurrentUser.IsAdmin)
                {
                    return(RedirectToAction("Index", "Teacher"));
                }
                var onlineUsers = AddOnlineUsers(CurrentUser);

                ViewBag.Assignments = _assignmentTaskAndSubmissionService.GetAllStudentUpcomingTaskAndAssignmentDeadlines(CurrentUser.Id);
                ViewBag.Messages    = _messageService.GetAllNotViewedStudentMessages(CurrentUser.Id);
                ViewBag.Courses     = _courseModuleService.GetAllStudentCourses(CurrentUser.Id);
                ViewBag.Schedule    = _scheduleService.GetSchedulesWithUnitsAndModulesByStudent(CurrentUser.Id);
                ViewBag.MyQuestions = _baseQuestionTopicModuleService.GetAllByStudent(CurrentUser.Id);
                ViewData["Units"]   = _unitModuleService.GetUnitsByStudent(CurrentUser.Id)
                                      .Where(u => u.PublishFrom.Value.Date.Equals(DateTime.Today)).OrderBy(u => u.PublishFrom);
                ViewData["Messages"]    = _messageService.GetAllStudentMessages(User.Id);
                ViewData["OnlineUsers"] = onlineUsers;
                return(View(CurrentUser));
            }
            catch (Exception)
            {
                return(RedirectToAction("LogOff", "Account"));
            }
        }