static Guid CreateMasterCourse(Guid organizationalUnitGuid) { ServiceFactory factory = new ServiceFactory(); IMasterCourseService mcService = factory.CreateMasterCourseService(); var masterCourse = new MasterCourse(); // the following are required fields. masterCourse.MasterCourseGuid = Guid.Empty; masterCourse.Name = "Test Master Course"; masterCourse.Programs.Add(organizationalUnitGuid); // the following are optional fields. masterCourse.Description = "master course description"; masterCourse.ShortDescription = "ShortDescription"; masterCourse.Categories = new List <string>(); masterCourse.Audiences = new List <string>(); var masterCourseGuid = mcService.Create(masterCourse); if (masterCourseGuid == Guid.Empty) { printError(mcService.LastError); } else { Console.WriteLine(string.Format("Master course {0} was created.", masterCourse.Name)); } return(masterCourseGuid); }
static void UpdateMasterCourse(Guid masterCourseGuid) { ServiceFactory factory = new ServiceFactory(); IMasterCourseService mcService = factory.CreateMasterCourseService(); var masterCourse = new MasterCourse(); // the following are required fields. masterCourse.MasterCourseGuid = masterCourseGuid; masterCourse.Name = "Test Master Course - Modified"; masterCourse.Programs = null; //Programlarda değişiklik istenmiyorsa bu değer null geçilmeli. // the following are optional fields. masterCourse.Description = "Description"; masterCourse.ShortDescription = "ShortDescription"; masterCourse.Categories = new List <string>(); masterCourse.Audiences = new List <string>(); bool success = mcService.Update(masterCourse); if (!success) { printError(mcService.LastError); } else { Console.WriteLine(string.Format("Name of master course {0} was updated to {1}.", masterCourse.MasterCourseGuid, masterCourse.Name)); } }
static void DeleteMasterCourse(Guid masterCourseGuid) { ServiceFactory factory = new ServiceFactory(); IMasterCourseService mcService = factory.CreateMasterCourseService(); bool success = mcService.Delete(masterCourseGuid); if (!success) { printError(mcService.LastError); } else { Console.WriteLine(string.Format("Master course {0} was deleted.", masterCourseGuid)); } }
static void SearchMasterCourses(string keyword, int offset = 0, int limit = 100) { ServiceFactory factory = new ServiceFactory(); IMasterCourseService mcService = factory.CreateMasterCourseService(); IEnumerable <MasterCourse> masterCourses = mcService.Search(keyword, true, offset, limit); // get master course data by masterCourseGuid if (mcService.LastError != null) { printError(mcService.LastError); } else { Console.WriteLine(string.Format("Master course count is {0}.", masterCourses.Count())); } }
static void GetMasterCourse(Guid masterCourseGuid) { ServiceFactory factory = new ServiceFactory(); IMasterCourseService mcService = factory.CreateMasterCourseService(); MasterCourse masterCourse = mcService.Get(masterCourseGuid); // get master course data by masterCourseGuid if (mcService.LastError != null) { printError(mcService.LastError); } else { string name = masterCourse.Name; Console.WriteLine(string.Format("Name of master course is {0}.", masterCourse.Name)); } }