示例#1
0
 public static void createSection(Section section)
 {
     BasicSchoolDbContext db = new BasicSchoolDbContext();
     db.Entry(section).State = EntityState.Added;
     db.Sections.Add(section);
     db.SaveChanges();
 }
示例#2
0
 public static void deleteCourse(Course course)
 {
     BasicSchoolDbContext db = new BasicSchoolDbContext();
     db.Entry(course).State = EntityState.Deleted;
     db.Courses.Remove(course);
     db.SaveChanges();
 }
示例#3
0
 public static void deleteSection(Section section)
 {
     BasicSchoolDbContext db = new BasicSchoolDbContext();
     db.Entry(section).State = EntityState.Deleted;
     db.Sections.Remove(section);
     db.SaveChanges();
 }
示例#4
0
 public static void createCourse(Course course)
 {
     BasicSchoolDbContext db = new BasicSchoolDbContext();
     db.Entry(course).State = EntityState.Added;
     db.Courses.Add(course);
     db.SaveChanges();
 }
示例#5
0
        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;
        }
示例#6
0
 public static Course getCourseDetails(int? id)
 {
     BasicSchoolDbContext db = new BasicSchoolDbContext();
     return db.Courses.Find(id);
 }
示例#7
0
 public static List<Course> getCourses()
 {
     BasicSchoolDbContext db = new BasicSchoolDbContext();
     return db.Courses.ToList();
 }
示例#8
0
 public static void editSection(Section section)
 {
     BasicSchoolDbContext db = new BasicSchoolDbContext();
     db.Entry(section).State = EntityState.Modified;
     db.SaveChanges();
 }
示例#9
0
 public static Section getSection(int? id)
 {
     BasicSchoolDbContext db = new BasicSchoolDbContext();
     return db.Sections.Find(id);
 }
示例#10
0
 public static List<Section> getSections()
 {
     BasicSchoolDbContext db = new BasicSchoolDbContext();
     return db.Sections.ToList();
 }
示例#11
0
 public static void editCourse(Course course)
 {
     BasicSchoolDbContext db = new BasicSchoolDbContext();
     db.Entry(course).State = EntityState.Modified;
     db.SaveChanges();
 }