Below is an example of dealing with a course for
o creating a course with a start and end date
o adding teachers to it
o adding students to it
More examples can be found in the downloaded SDK package. Please check the below example:
Course course = LMSContext.Current.Organization.Courses.Add("Course title",
course.Published = true;
course.StartDate = StartDateTime; // set start date
course.EndDate = EndDateTime; // set end date
course. AddTeacher(userName); // add one teacher by user name
course.SetTeachers(userNamesList); // or add a few teachers
course.SetLearners(userNamesList); // add learners
LMSContext.AllCourses are all courses on the current web application.
To create a new course you need to add it to the specified organization and use the course collection of the organization: Organization.Courses.