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"));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// GET: /Discussion/
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            //int userId = userapp
            UserViewModel user = _userAppService.GetUserByUserName(WebSecurity.CurrentUserName);

            if (user != null)
            {
                ViewData["StudentCourses"] = new SelectList(_courseModuleAppService.GetAllStudentCourses(user.Id, false), "Id", "Title", "");
            }
            ViewData["DiscussionThread"]       = _discussionAppService.GetDiscussionsByStaffId(user.Id);
            ViewData["SelectedStudentCourses"] = 0;
            return(View("Discussion"));
        }