public void UpdateInstructors(Instructor[] instructors)
 {
     using (ClassAdministrationEntityContext context = new ClassAdministrationEntityContext(BUTEClassAdministrationService.Properties.Resources.connectionString))
     {
         foreach (var instructor in instructors)
         {
             context.InstructorSet.ApplyChanges(instructor);
         }
         context.SaveChanges();
     }
 }
        public InstructorViewModel(Instructor selectedInstructor)
        {
            ModifyableInstructor = selectedInstructor;

            modify = true;
            _instructor = new Instructor();
            _instructor.clone(selectedInstructor);

            insertInstructorWindow = new InsertInstructorWindow();

            insertInstructorWindow.DataContext = this;

            insertInstructorWindow.ShowDialog();
        }
        public InstructorViewModel()
        {
            modify = false;
            _instructor =  new Instructor();
            Name = "";
            Neptun = "";
            Email = "";

            insertInstructorWindow = new InsertInstructorWindow();

            insertInstructorWindow.DataContext = this;

            insertInstructorWindow.ShowDialog();
        }
 public void clone(Instructor src)
 {
     this.Name = src.Name;
     this.Neptun = src.Neptun;
     this.Email = src.Email;
 }
        private void FixupInstructor(Instructor previousValue)
        {
            if (IsDeserializing)
            {
                return;
            }

            if (previousValue != null && previousValue.Group.Contains(this))
            {
                previousValue.Group.Remove(this);
            }

            if (Instructor != null)
            {
                if (!Instructor.Group.Contains(this))
                {
                    Instructor.Group.Add(this);
                }

            }
            if (ChangeTracker.ChangeTrackingEnabled)
            {
                if (ChangeTracker.OriginalValues.ContainsKey("Instructor")
                    && (ChangeTracker.OriginalValues["Instructor"] == Instructor))
                {
                    ChangeTracker.OriginalValues.Remove("Instructor");
                }
                else
                {
                    ChangeTracker.RecordOriginalValue("Instructor", previousValue);
                }
                if (Instructor != null && !Instructor.ChangeTracker.ChangeTrackingEnabled)
                {
                    Instructor.StartTracking();
                }
                FixupInstructorKeys();
            }
        }