Beispiel #1
0
        public ActionResult Play(int id)
        {
            var disciplineService = LmsService.FindService <ICurriculumService>();

            var topic = disciplineService.GetTopic(id);

            if (topic == null)
            {
                return(View("Error", "~/Views/Shared/Site.Master", Localization.getMessage("Topic_Not_Found")));
            }

            var currentUser   = UserService.GetCurrentUser();
            var topics        = disciplineService.GetTopicsAvailableForUser(currentUser).Select(t => t.Topic).Where(t => t.Id == topic.Id);
            var containsTopic = topics.Count() == 1;

            if (!containsTopic)
            {
                return(View("Error", "~/Views/Shared/Site.Master", Localization.getMessage("Not_Allowed_Pass_Topic")));
            }

            long attemptId = MlcProxy.GetAttemptId(topic);

            ServicesProxy.Instance.Initialize(LmsService);

            return(View("Play", new PlayModel {
                AttemptId = attemptId, TopicId = topic.Id
            }));
        }
Beispiel #2
0
        public ActionResult Play(int id)
        {
            var curriculumService = LmsService.FindService <ICurriculumService>();

            var theme = curriculumService.GetTheme(id);

            if (!curriculumService.GetThemesAvailableForUser(UserService.GetCurrentUser()).Select(t => t.Theme).Contains(theme))
            {
                return(View("Error", "You are not allowed to pass this theme."));
            }

            long attemptId = MlcProxy.GetAttemptId(theme);

            ServicesProxy.Instance.Initialize(LmsService);

            return(View("Play", new PlayModel {
                AttemptId = attemptId, ThemeId = theme.Id
            }));
        }