public void DeleteStudent(int id)
        {
            var db      = new StudentEntities4();
            var student = db.Students.Find(id);

            db.Students.Remove(student);
            db.SaveChanges();
        }
        public void UpdateStudent(int id, string code, string name, DateTime birthday, int class_id, string email, string hometown, string faculty)
        {
            var db      = new StudentEntities4();
            var student = db.Students.Find(id);

            student.Code       = code;
            student.Name       = name;
            student.Birthday   = birthday;
            student.Class_id   = class_id;
            student.Email      = email;
            student.Home_Town  = hometown;
            student.Faculty_ID = faculty;;

            db.Entry(student).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
        }
        public void CreateStudent(string code, string name, DateTime birthday, int class_id, string email, string hometown, string faculty)
        {
            var student = new Student();

            student.Code       = code;
            student.Name       = name;
            student.Birthday   = birthday;
            student.Class_id   = class_id;
            student.Email      = email;
            student.Home_Town  = hometown;
            student.Faculty_ID = faculty;

            var db = new StudentEntities4();

            db.Students.Add(student);
            db.SaveChanges();
        }
        public Faculty[] getFaculty()
        {
            var db = new StudentEntities4();

            return(db.Faculties.ToArray());
        }
        public Class[] GetClasses()
        {
            var db = new StudentEntities4();

            return(db.Classes.ToArray());
        }
        public Student GetStudent(int id)
        {
            var db = new StudentEntities4();

            return(db.Students.Find(id));
        }
        public Student[] GetStudents()
        {
            var db = new StudentEntities4();

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