public CourseUsersViewModel GetCourseUsers(int vakcode)
        {
            Course course = db.Course.Find(vakcode);

            CourseUsersViewModel cuvw = new CourseUsersViewModel
            {
                cId     = course.Id,
                Vakcode = course.Vakcode,
                Titel   = course.Titel
            };

            cuvw.users = GetUsersSubForCourse(vakcode);

            return(cuvw);
        }
Beispiel #2
0
        public ActionResult CourseUsers(int?id)
        {
            //If somehow we recieve a id which is null we redirect the user to the Homepage rather than rendering the view
            if (id == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            //Getting the current user so that we can display his name and profile image in the corer
            account user   = accountHelper.getCurrentUser(Session["User"].ToString());
            int     userId = user.id;

            ViewBag.userName  = user.name;
            ViewBag.imagePath = user.imagePath;
            int courseID = Convert.ToInt32(id);
            CourseUsersViewModel info = new CourseUsersViewModel {
                courseId = courseID, enrolled = crsService.GetStudentsOfCourse(courseID), notEnrolled = crsService.GetUsersNotInCourse(courseID)
            };


            return(View(info));
        }