Ejemplo n.º 1
0
        public ActionResult Dashboard()
        {
            ActionResult result = null;

            if (!IsAuthenticated)
            {
                result = RedirectToAction("Login", "Home");
            }
            else
            {
                if (this.IsTeacher)
                {
                    DashboardTeacherViewModel dashboardModel = new DashboardTeacherViewModel
                    {
                        //Assignments = _db.GetStudentAssignmentsForTeacher(this.CurrentUser.UserId),
                        Courses  = _db.GetCoursesForTeacher(this.CurrentUser.UserId),
                        Users    = _db.GetUsersForTeacher(this.CurrentUser.UserId),
                        AllUsers = _db.GetAllUsers()
                    };

                    dashboardModel.CoursesWithPic = _db.GetCoursesWithPicForATeacher(this.CurrentUser.UserId);

                    result = View("DashboardTeacher", dashboardModel);
                }
                else
                {
                    DashboardStudentViewModel dashboardModel = new DashboardStudentViewModel
                    {
                        EnrolledCourses = _db.GetCoursesForStudent(this.CurrentUser.UserId),
                        Users           = _db.GetAllUsers()
                    };

                    result = View("DashboardStudent", dashboardModel);
                }
            }
            return(result);
        }