コード例 #1
0
        public PM20569 GetStudent(int id)
        {
            var db       = new OOPCS2Entities();
            var students = db.PM20569.Find(id);

            return(students);
        }
コード例 #2
0
        public PM20569[] GetStudent()
        {
            var db       = new OOPCS2Entities();
            var students = db.PM20569.ToArray();

            return(students);
        }
コード例 #3
0
        public void DeleteStudent(int id)
        {
            var db       = new OOPCS2Entities();
            var students = db.PM20569.Find(id);

            db.PM20569.Remove(students);
            db.SaveChanges();
        }
コード例 #4
0
        public void EditStudent(int id, string code, string name, bool gender, string HomeTown)
        {
            var db      = new OOPCS2Entities();
            var student = db.PM20569.Find(id);

            student.Code     = code;
            student.Name     = name;
            student.Gender   = gender;
            student.Hometown = HomeTown;

            db.Entry(student).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
        }
コード例 #5
0
        public void AddStudent(string code, string name, bool gender, string HomeTown)
        {
            var students = new PM20569();

            students.Code     = code;
            students.Name     = name;
            students.Gender   = gender;
            students.Hometown = HomeTown;

            var db = new OOPCS2Entities();

            db.PM20569.Add(students);
            db.SaveChanges();
        }