示例#1
0
        public PM14008 GetStudents(int id)
        {
            var db       = new OOPCSEntities();
            var @student = db.PM14008.Find(id);

            return(@student);
        }
示例#2
0
        public void DeleteStudent(int id)
        {
            var db      = new OOPCSEntities();
            var student = db.PM14008.Find(id);

            db.PM14008.Remove(student);
            db.SaveChanges();
        }
示例#3
0
        public void EditStudent(int ID, string Code, string Name, Boolean Gender, string Hometown)
        {
            var db         = new OOPCSEntities();
            var oldStudent = db.PM14008.Find(ID);

            oldStudent.Code     = Code;
            oldStudent.Name     = Name;
            oldStudent.Gender   = Gender;
            oldStudent.Hometown = Hometown;

            db.Entry(oldStudent).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
        }
示例#4
0
        public void AddStudent(string Code, string Name, bool Gender, string Hometown)
        {
            var newStudent = new PM14008();

            newStudent.Code     = Code;
            newStudent.Name     = Name;
            newStudent.Gender   = Gender;
            newStudent.Hometown = Hometown;

            var db = new OOPCSEntities();

            db.PM14008.Add(newStudent);
            db.SaveChanges();
        }
示例#5
0
        public PM14008[] GetClasses()
        {
            var db = new OOPCSEntities();

            return(db.PM14008.ToArray());
        }