// GET: Course
        public ActionResult Index()
        {
            var userId = User.Identity.GetUserId();

            if (userId != null && UserRolesModel.IsStudent(userId) || UserRolesModel.IsTeacher(userId) || UserRolesModel.IsAdmin(userId))
            {
                return(View());
            }
            else
            {
                return(RedirectToAction("Unauthorized", "User"));
            }
        }
        //
        // GET: /Manage/Index
        public async Task <ActionResult> Index(ManageMessageId?message)
        {
            ViewBag.StatusMessage =
                message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
                : message == ManageMessageId.SetPasswordSuccess ? "Your password has been set."
                : message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set."
                : message == ManageMessageId.Error ? "An error has occurred."
                : message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added."
                : message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed."
                : "";

            var userId = User.Identity.GetUserId();
            var model  = new IndexViewModel
            {
                HasPassword       = HasPassword(),
                PhoneNumber       = await UserManager.GetPhoneNumberAsync(userId),
                TwoFactor         = await UserManager.GetTwoFactorEnabledAsync(userId),
                Logins            = await UserManager.GetLoginsAsync(userId),
                BrowserRemembered = await AuthenticationManager.TwoFactorBrowserRememberedAsync(userId),
                IsStudent         = UserRolesModel.IsStudent(User.Identity.GetUserId()) || (!UserRolesModel.IsTeacher(User.Identity.GetUserId()) && !UserRolesModel.IsAdmin(User.Identity.GetUserId()))
            };

            return(View(model));
        }
        public ActionResult View(string id)
        {
            var userId = User.Identity.GetUserId();

            return(View(CourseViewModel.ViewCourse(id, UserRolesModel.IsAdmin(userId), UserRolesModel.IsTeacher(userId), UserRolesModel.IsStudent(userId))));
        }