private void Remove()
 {
     if (Index >= 0)
     {
         ClassClassroom.RemoveAt(Index);
     }
 }
        private void Load()
        {
            string         pathToCsv      = "";
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Файл csv|*.csv";
            if (openFileDialog.ShowDialog() == true)
            {
                pathToCsv = openFileDialog.FileName;
            }
            if (File.Exists(pathToCsv))
            {
                char[] delimiters = new char[] { ';' };
                using (StreamReader reader = new StreamReader(pathToCsv, System.Text.Encoding.Default))
                {
                    while (true)
                    {
                        string line = reader.ReadLine();
                        if (line == null)
                        {
                            break;
                        }
                        string[] parts = line.Split(delimiters);
                        bool     exist = false;
                        foreach (var classroom in ClassClassroom)
                        {
                            if (classroom.NumberOfClassroom.Equals(parts[0].Trim(' ')))
                            {
                                exist = true;
                            }
                        }
                        if (!exist)
                        {
                            Department Department = null;
                            foreach (var dep in departments)
                            {
                                if (dep.NameOfDepartment.Equals(parts[2].Trim(' ')))
                                {
                                    Department = dep;
                                }
                            }
                            if (Department != null)
                            {
                                ClassRoom classroom = new ClassRoom
                                {
                                    NumberOfClassroom = parts[0].Trim(' '),
                                    Specific          = parts[1].Trim(' '),
                                    Department        = Department
                                };

                                if (RequestToDataBase.Instance.requestInsertIntoClassroom(classroom))
                                {
                                    ClassClassroom.Add(classroom);
                                }
                            }
                        }
                    }
                }
            }
        }
 private void Remove()
 {
     if (Index >= 0)
     {
         if (RequestToDataBase.Instance.requestDeleteFromClassroom(ClassClassroom, Index))
         {
             ClassClassroom.RemoveAt(Index);
         }
     }
 }
        private void Add()
        {
            var context = new ClassroomVM(departments.ToArray());
            var wind    = new NewClassroom()
            {
                DataContext = context
            };

            wind.ShowDialog();
            if (context.ClassRoom != null)
            {
                ClassClassroom.Add(context.ClassRoom);
            }
        }
        private void Add()
        {
            var context = new ClassroomVM(departments.ToArray());
            var wind    = new NewClassroom()
            {
                DataContext = context
            };

            wind.ShowDialog();
            if (wind.DialogResult == true)
            {
                if (context.ClassRoom != null)
                {
                    if (RequestToDataBase.Instance.requestInsertIntoClassroom(context.ClassRoom))
                    {
                        ClassClassroom.Add(context.ClassRoom);
                    }
                }
            }
        }