Exemplo n.º 1
0
        public m_section_overview UpsertSection(Guid courseID, m_section_overview section)
        {
            Course course;
            Section s = null;

            if (section.id.IsNullOrEmpty())
                GetCourse(courseID, out course);
            else
                GetCourseAndSection(courseID, section.id, out course, out s);

            if (s == null)
            {
                s = new Section {SortOrder = course.Sections.Count};
                course.Sections.Add(s);
            }

            s.Title = section.title;

            _entityRepository.Save(course);

            return s;
        }
Exemplo n.º 2
0
 public m_section_overview UpsertSection(Guid courseID, m_section_overview section)
 {
     return new SectionControllerTests().UpsertSection(courseID, section);
 }
Exemplo n.º 3
0
 public m_section_overview UpsertSection(Guid courseID, m_section_overview section)
 {
     return ExecutePutRequest<m_section_overview>(courseID.ToString(), section);
 }
Exemplo n.º 4
0
        public void CanUpsertAndDeleteSection()
        {
            var course = GetCourses().FirstOrDefault();
            Assert.IsNotNull(course);

            var section = new m_section_overview {title = "Newly Created Section"};
            var newSection = UpsertSection(course.id, section);
            Assert.IsNotNull(newSection);
            Assert.IsFalse(newSection.id.IsNullOrEmpty());
            Assert.AreEqual(section.title, newSection.title);

            newSection.title = "Updated Section Title";

            var updatedSection = UpsertSection(course.id, newSection);
            Assert.IsNotNull(updatedSection);
            Assert.AreEqual(newSection.id, updatedSection.id);
            Assert.AreEqual(newSection.title, updatedSection.title);

            DeleteSection(course.id, updatedSection.id);

            section = GetSections(course.id).FirstOrDefault(s=>s.id == updatedSection.id);
            Assert.IsNull(section);
        }
Exemplo n.º 5
0
 public void RenameSection(Guid courseID, m_section_overview section)
 {
     ExecutePutRequest("rename/" + courseID + "/" + section.id, section.title);
 }