public static void createSection(Section section) { BasicSchoolDbContext db = new BasicSchoolDbContext(); db.Entry(section).State = EntityState.Added; db.Sections.Add(section); db.SaveChanges(); }
public static void deleteCourse(Course course) { BasicSchoolDbContext db = new BasicSchoolDbContext(); db.Entry(course).State = EntityState.Deleted; db.Courses.Remove(course); db.SaveChanges(); }
public static void deleteSection(Section section) { BasicSchoolDbContext db = new BasicSchoolDbContext(); db.Entry(section).State = EntityState.Deleted; db.Sections.Remove(section); db.SaveChanges(); }
public static void createCourse(Course course) { BasicSchoolDbContext db = new BasicSchoolDbContext(); db.Entry(course).State = EntityState.Added; db.Courses.Add(course); db.SaveChanges(); }
public static CourseSection getCourseAndSections(int? id) { BasicSchoolDbContext db = new BasicSchoolDbContext(); CourseSection courseSection = new CourseSection(); courseSection.course = getCourse(id); var sections = db.Sections.Where(s => s.CourseNumber == courseSection.course.CourseNumber); courseSection.sections = sections.ToList(); return courseSection; }
public static Course getCourseDetails(int? id) { BasicSchoolDbContext db = new BasicSchoolDbContext(); return db.Courses.Find(id); }
public static List<Course> getCourses() { BasicSchoolDbContext db = new BasicSchoolDbContext(); return db.Courses.ToList(); }
public static void editSection(Section section) { BasicSchoolDbContext db = new BasicSchoolDbContext(); db.Entry(section).State = EntityState.Modified; db.SaveChanges(); }
public static Section getSection(int? id) { BasicSchoolDbContext db = new BasicSchoolDbContext(); return db.Sections.Find(id); }
public static List<Section> getSections() { BasicSchoolDbContext db = new BasicSchoolDbContext(); return db.Sections.ToList(); }
public static void editCourse(Course course) { BasicSchoolDbContext db = new BasicSchoolDbContext(); db.Entry(course).State = EntityState.Modified; db.SaveChanges(); }