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

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

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