Beispiel #1
0
        public void UpdateStudent(StudentData student)
        {
            using (SchoolDB db = new SchoolDB())
            {
                var EditedObj = db.Student.Find(student.ID);

                if (EditedObj != null)//if student is found
                {
                    EditedObj.StudentName = student.Name;
                    db.SaveChanges();
                }
            }
        }
Beispiel #2
0
        public StudentData GetStudent(int StudentID)
        {
            var student = new StudentData();

            using (SchoolDB db = new SchoolDB())
            {
                var studentDB = db.Student.Find(StudentID);

                student.ID   = studentDB.StudentID;
                student.Name = studentDB.StudentName;
            }

            return(student);
        }