Ejemplo n.º 1
0
 public void Delete(Score score)
 {
     using (var context = new coursecontrolContext())
     {
         context.Score.Remove(score);
         context.SaveChanges();
     }
 }
Ejemplo n.º 2
0
 public void Add(Student student)
 {
     using (var context = new coursecontrolContext())
     {
         context.Student.Add(student);
         context.SaveChanges();
     }
 }
Ejemplo n.º 3
0
 public void Add(Teacher teacher)
 {
     using (var context = new coursecontrolContext())
     {
         context.Teacher.Add(teacher);
         context.SaveChanges();
     }
 }
Ejemplo n.º 4
0
 public void Update(Score score)
 {
     using (var context = new coursecontrolContext())
     {
         context.Score.Update(score);
         context.SaveChanges();
     }
 }
Ejemplo n.º 5
0
 public void Add(Selectcourse selectcourse)
 {
     using (var context = new coursecontrolContext())
     {
         context.Selectcourse.Add(selectcourse);
         context.SaveChanges();
     }
 }
Ejemplo n.º 6
0
 public void Add(Course course)
 {
     using (var context = new coursecontrolContext())
     {
         context.Course.Add(course);
         context.SaveChanges();
     }
 }
Ejemplo n.º 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();
     }
 }
Ejemplo n.º 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();
     }
 }
Ejemplo n.º 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();
     }
 }
Ejemplo n.º 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();
     }
 }
Ejemplo n.º 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();
     }
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }