예제 #1
0
        public void Edit(Student student)
        {
            SetRelativeEntities(student);

            db.Entry(student).State = EntityState.Modified;
            db.SaveChanges();
        }
예제 #2
0
        public void Add(Student student)
        {
            SetRelativeEntities(student);

            db.Students.Add(student);
            db.SaveChanges();
        }
예제 #3
0
 private void SetRelativeEntities(Student student)
 {
     var group = db.Groups.Find(student.Group.id);
     student.Group = group;
 }