public void AddCourse(string courseName) { using (var context = new CourseDbContext()) { DE.Course course = new DE.Course(); course.Description = courseName; context.Courses.Add(course); context.SaveChanges(); } }
public void AddCoursewithPreRequiste(string courseName, string PreRequisite) { using (var context = new CourseDbContext()) { DE.PrerequisiteCourse preReq = new DE.PrerequisiteCourse(); preReq.Id_Course = this.getCourseID(courseName); int preReqId = this.getCourseID(PreRequisite); if (preReqId > 0) { preReq.Id_Prereq_Course = preReqId; } context.PrerequisiteCourses.Add(preReq); context.SaveChanges(); } }