Example #1
0
        public ClassroomViewModel CreateQuestion(string accessCode, string question, string userId)
        {
            var classroom = _classroomRepository.GetClassroomByAccessCode(accessCode);

            classroom.Voqus.Add(new Models.Voqu()
            {
                Question = question, Id = classroom.Voqus.Count + 1
            });
            var viewModel = SetupViewModel(classroom, userId);

            viewModel.Question = "";

            return(viewModel);
        }
Example #2
0
        public IActionResult JoinClassroom(HomeViewModel model)
        {
            string userId    = GetUserId();
            var    classroom = _classroomRepository.GetClassroomByAccessCode(model.ClassroomAccessCode);

            if (classroom == null)
            {
                model.ErrorMessage = "There is no active classroom with the given access code. Please try again.";
                return(View("Index", model));
            }

            ClassroomViewModel viewModel = SetupViewModel(userId, classroom);

            return(View("Classroom", viewModel));
        }