public IActionResult RegisterToClass(int courseId)
        {
            var registerToClassViewModel = new RegisterToClassViewModel()
            {
                CourseId = courseId
            };

            return(View(registerToClassViewModel));
        }
        public IActionResult RegisterToClass(RegisterToClassViewModel registerToClassViewModel)
        {
            var classDb = _classesRepository.GetById(registerToClassViewModel.CourseId);
            var userId  = userManager.GetUserId(User);
            var userDb  = userRepository.GetByUserId(userId);

            if (classDb.SecurityCode == registerToClassViewModel.SecurityCode)
            {
                var userClass = new UserClass
                {
                    User  = userDb,
                    Class = classDb
                };
                userRepository.AddUserToClass(userClass);
                return(RedirectToAction("Class", new { courseId = registerToClassViewModel.CourseId }));
            }
            return(View(registerToClassViewModel));
        }