コード例 #1
0
ファイル: Course.cs プロジェクト: sgurusamy/CourseWebApi
        public void SaveCourse()
        {
            CourseRepository repo = new CourseRepository();
            List<string> getAllCourses = repo.getAllCourses();

            var abc = getAllCourses.Intersect(orderedCourseList.ToList<string>());
            foreach (string str in abc)
            {
                isCourseAlreadyExists = true;
                return;
            }
            foreach (string course in orderedCourseList)
                repo.AddCourse(course);
        }
コード例 #2
0
ファイル: Course.cs プロジェクト: sgurusamy/CourseWebApi
 public void SaveCourseWithPreRequisite()
 {
     CourseRepository repo = new CourseRepository();
     string[] courseAlongWithPre = new string[2];
     foreach (string course in this.allCourses)
     {
         courseAlongWithPre = course.Split(':');
         if (!withoutPreRequisiteCourses.Any(str => str.Contains(courseAlongWithPre[0])))
             repo.AddCoursewithPreRequiste(courseAlongWithPre[0].Trim(), courseAlongWithPre[1].Trim());
         else
             repo.AddCoursewithPreRequiste(courseAlongWithPre[0], string.Empty);
     }
 }