Exemplo n.º 1
0
        public void DeleteStudent(int id)
        {
            var db      = new OOPCSEntities();
            var student = db.PM13894.Find(id);

            db.PM13894.Remove(student);
            db.SaveChanges();
        }
Exemplo n.º 2
0
        public void EditStudent(int id, string name, string code, string hometown, bool gender)
        {
            var db         = new OOPCSEntities();
            var oldStudent = db.PM13894.Find(id);

            oldStudent.Name            = name;
            oldStudent.Code            = code;
            oldStudent.Hometown        = hometown;
            oldStudent.Gender          = gender;
            db.Entry(oldStudent).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
        }
Exemplo n.º 3
0
        public void AddStudent(string name, string code, string hometown, bool gender)
        {
            var newStudent = new PM13894();

            newStudent.Name     = name;
            newStudent.Hometown = hometown;
            newStudent.Code     = code;
            newStudent.Gender   = gender;

            var db = new OOPCSEntities();

            db.PM13894.Add(newStudent);
            db.SaveChanges();
        }