static Guid CreateClass(Guid courseGuid, Guid programGuid) { ServiceFactory factory = new ServiceFactory(); IClassService cService = factory.CreateClassService(); var _class = new Class(); // the following are required fields. _class.Name = "This is test class"; _class.CourseGuid = courseGuid; _class.ProgramGuid = programGuid; // the following are optional fields. _class.StartDate = null; _class.EndDate = null; Guid classGuid = cService.Create(_class); if (classGuid == Guid.Empty) { printError(cService.LastError); } else { Console.WriteLine(string.Format("Class {0} was created.", _class.Name)); } return classGuid; }
static void AddTeacherToClass() { ServiceFactory factory = new ServiceFactory(); IClassService cService = factory.CreateClassService(); string classGuid = "d3a65d5b-2045-47db-a326-ab787a2fe371"; List<string> teacherList = new List<string>() { "user_10", "user_11" }; bool success = cService.AddTeachers(classGuid, teacherList); if (!success) { printError(cService.LastError); } else { Console.WriteLine(string.Format("Teachers are added specified class {0}.", classGuid)); } }