Ejemplo n.º 1
0
        /// <summary>
        /// A function that displays a view for a student in a certain course.
        /// Displays ongoing and past projects with their grades
        /// </summary>
        public ActionResult StudentOverview(int id)
        {
            #region Security
            SecurityRedirect redirect = accountService.VerifySecurityLevel
                                        (
                auth: User.Identity.IsAuthenticated,
                secLevel: SecurityState.STUDENT,
                userID: User.Identity.GetUserId(),
                courseID: id
                                        );
            if (redirect.Redirect)
            {
                return(RedirectToAction(redirect.ActionName, redirect.ControllerName));
            }
            #endregion

            CourseViewModel viewModel = service.GetCoursesById(id, User.Identity.GetUserId());
            string          userID    = User.Identity.GetUserId();
            viewModel           = assignmentService.GetGrades(userID, viewModel);
            viewModel.isTeacher = false;
            return(View(viewModel));
        }