コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            enrollmentId = Request.QueryString["enid"];
            lessonId     = Request.QueryString["lsid"];

            var lesson = LessonService.GetLessonById(lessonId, enrollmentId);

            logger.Debug(lesson.Scorm.ManifestXml);
            var        xmlDoc = XDocument.Parse(lesson.Scorm.ManifestXml);
            XNamespace ns     = xmlDoc.Root.GetDefaultNamespace();

            foreach (XElement element in xmlDoc.Descendants(ns + "resource"))
            {
                var href = element.Attribute("href");
                logger.Debug("element: {0}, attribute: {1}, ns: {2}", element.Name, href, ns);

                if (href != null)
                {
                    scormUrl = string.Format("/{0}/{1}", lesson.Scorm.WebPath, href.Value);
                    break;
                }
            }

            logger.Info(scormUrl);
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            courseId = Request.QueryString["csid"];
            lessonId = Request.QueryString["lsid"];

            if (!IsPostBack)
            {
                ScormRepeater.DataSource = ScormService.LoadAllScorms(SessionVariable.Current.Company.Id).OrderBy(x => x.Name);
                ScormRepeater.DataBind();

                QuizRepeater.DataSource = QuizService.LoadAllQuizzes(SessionVariable.Current.Company.Id).OrderBy(x => x.Title);
                QuizRepeater.DataBind();

                var lesson = LessonService.GetLessonById(SessionVariable.Current.Company.Id, courseId, lessonId);
                if (lesson != null)
                {
                    LessonName.Text  = lesson.Name;
                    Description.Text = lesson.Description;

                    if (lesson.Course.CourseType == CourseTypeEnum.External)
                    {
                        Panel1.Visible = false;
                    }
                    else
                    {
                        CurriculumType.SelectedValue = ((int)lesson.LessonType).ToString();
                        ScormId.Value = lesson.ScormId;
                        QuizId.Value  = lesson.QuizId;
                    }
                }
            }
        }
コード例 #3
0
        public ActionResult Details(int id)
        {
            var service = new LessonService();
            var model   = service.GetLessonById(id);

            return(View(model));
        }
コード例 #4
0
        public async Task <IActionResult> GetLessonById(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "Lesson/GetById/{id}/{pk}")] HttpRequest req,
            string id,
            string pk,
            [SwaggerIgnore] ILogger log)
        {
            try
            {
                var data = await _lessonService.GetLessonById(id, new Dictionary <string, string> {
                    { "LessonCode", pk }
                });

                if (data == null)
                {
                    return(new NotFoundObjectResult("Data not found !!!!"));
                }
                var dataDTO = _mapper.Map <LessonDTO>(data);
                return(new OkObjectResult(dataDTO));
            }
            catch (Exception ex)
            {
                return(new BadRequestObjectResult(ex.Message));
            }
        }
コード例 #5
0
        public async Task GetLessonById_ReturnsExistingLessonAnswer()
        {
            //Arrange
            var lesson   = AutoFaker.Generate <Lesson>();
            var lessonId = AutoFaker.Generate <int>();

            _askmeRepository.Setup(x => x.GetLessonById(It.IsAny <int>()))
            .ReturnsAsync(lesson);

            //Act
            var result = await _sut.GetLessonById(lessonId);

            //Assert
            result.Should().BeOfType <Lesson>();
            result.Should().BeEquivalentTo(lesson);
        }
コード例 #6
0
            public async Task GetDataById_ReusltFound(string id)
            {
                var repo = new Mock<IDocumentDBRepository<Lesson>>();
                var lessonData = lessonList.Where(o => o.Id == id).First();

                repo.Setup(c => c.GetByIdAsync(
                    It.IsAny<string>(),
                    It.IsAny<Dictionary<string, string>>()
                )).Returns(
                    Task.FromResult<Lesson>(lessonData)
                );

                var svc = new LessonService(repo.Object);

                var act = await svc.GetLessonById("", null);
                Assert.Equal(lessonData, act);
            }
コード例 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            enrollmentId = Request.QueryString["enid"];
            lessonId     = Request.QueryString["lsid"];


            lesson = LessonService.GetLessonById(lessonId, enrollmentId);
            quiz   = lesson.Quiz;
            quizId = quiz.Id;

            var bindQuestions = quiz.LoadActiveQuizQuestions().OrderBy(x => x.Order).ToList();

            QuizNumRepeater.DataSource = bindQuestions;
            QuizNumRepeater.DataBind();

            QuestionRepeater.DataSource = bindQuestions;
            QuestionRepeater.DataBind();
        }