Пример #1
0
 public void Delete(Score score)
 {
     using (var context = new coursecontrolContext())
     {
         context.Score.Remove(score);
         context.SaveChanges();
     }
 }
Пример #2
0
 public void Add(Student student)
 {
     using (var context = new coursecontrolContext())
     {
         context.Student.Add(student);
         context.SaveChanges();
     }
 }
Пример #3
0
 public void Add(Teacher teacher)
 {
     using (var context = new coursecontrolContext())
     {
         context.Teacher.Add(teacher);
         context.SaveChanges();
     }
 }
Пример #4
0
 public void Update(Score score)
 {
     using (var context = new coursecontrolContext())
     {
         context.Score.Update(score);
         context.SaveChanges();
     }
 }
Пример #5
0
 public void Add(Selectcourse selectcourse)
 {
     using (var context = new coursecontrolContext())
     {
         context.Selectcourse.Add(selectcourse);
         context.SaveChanges();
     }
 }
Пример #6
0
 public void Add(Course course)
 {
     using (var context = new coursecontrolContext())
     {
         context.Course.Add(course);
         context.SaveChanges();
     }
 }
Пример #7
0
 public void Delete(int id)
 {
     using (var context = new coursecontrolContext())
     {
         var student = context.Student.FirstOrDefault(x => x.StuId == id);
         context.Student.Remove(student);
         context.SaveChanges();
     }
 }
Пример #8
0
 public void Delete(int id)
 {
     using (var context = new coursecontrolContext())
     {
         var teacher = context.Teacher.FirstOrDefault(x => x.TeacherId == id);
         context.Teacher.Remove(teacher);
         context.SaveChanges();
     }
 }
Пример #9
0
 public void Delete(int id, int coursecode)
 {
     using (var context = new coursecontrolContext())
     {
         var course = context.Course.FirstOrDefault(x => x.CourseCode == coursecode);
         context.Course.Remove(course);
         context.SaveChanges();
     }
 }
Пример #10
0
 public void Delete(int coursecode, int stuid)
 {
     using (var context = new coursecontrolContext())
     {
         var selectcourse = context.Selectcourse.Where(d => d.StudentId == stuid).FirstOrDefault(x => x.CourseId == coursecode);
         context.Selectcourse.Remove(selectcourse);
         context.SaveChanges();
     }
 }
Пример #11
0
 public void Add(int id, int code)
 {
     using (var context = new coursecontrolContext())
     {
         Score score = new Score();
         score.CstuId      = id;
         score.CcourseCode = code;
         context.Score.Add(score);
         context.SaveChanges();
     }
 }
Пример #12
0
        public Teacher Query(int teacherId)
        {
            Teacher teacher = null;

            using (var context = new coursecontrolContext())
            {
                teacher = context.Teacher.FirstOrDefault(x => x.TeacherId == teacherId);
                context.SaveChanges();
            }
            return(teacher);
        }
Пример #13
0
        public Score QueryByCode(int code, int id)
        {
            Score score = null;

            using (var context = new coursecontrolContext())
            {
                score = context.Score.FirstOrDefault(x => x.CcourseCode == code && x.CstuId == id);
                context.SaveChanges();
            }
            return(score);
        }
Пример #14
0
        public Student Query(int stuId)
        {
            Student student = null;

            using (var context = new coursecontrolContext())
            {
                student = context.Student.FirstOrDefault(x => x.StuId == stuId);
                context.SaveChanges();
            }
            return(student);
        }
Пример #15
0
        public Course Query(int CourseCode)
        {
            Course course = null;

            using (var context = new coursecontrolContext())
            {
                course = context.Course.FirstOrDefault(x => x.CourseCode == CourseCode);
                context.SaveChanges();
            }
            return(course);
        }
Пример #16
0
        public List <Score> Query(int id)
        {
            List <Score> listScore = new List <Score>();

            using (var context = new coursecontrolContext())
            {
                listScore = (from u in context.Score
                             where u.CstuId == id
                             select u
                             ).ToList();
                context.SaveChanges();
            }
            return(listScore);
        }
Пример #17
0
        public List <Course> Query(string type)
        {
            List <Course> listCourse = new List <Course>();

            using (var context = new coursecontrolContext())
            {
                listCourse = (from u in context.Course
                              where u.CourseType == type
                              select u
                              ).ToList();
                context.SaveChanges();
            }
            return(listCourse);
        }
Пример #18
0
        public Selectcourse Query(int stuid)//
        {
            Selectcourse selectcourse = null;

            using (var context = new coursecontrolContext())
            {
                var test = context.Selectcourse.ToList();
                foreach (var item in test)
                {
                }
                //selectcourse = context.Selectcourse.FirstOrDefault(x => x.StudentId == stuid);
                context.SaveChanges();
            }
            return(selectcourse);
        }