private void ButtonUpdateRecord_Click(object sender, RoutedEventArgs e)
        {
            string column1  = TextBoxImie.Text;
            string column2  = TextBoxNazwisko.Text;
            string column3  = TextBoxPesel.Text;
            string column4  = TextBoxAdres.Text;
            string column5  = TextBoxMiasto.Text;
            string column6  = TextBoxKodPocztowy.Text;
            string column7  = TextBoxKraj.Text;
            string column8  = TextBoxTelefon.Text;
            string column9  = TextBoxEmail.Text;
            string column10 = TextBoxNazwaFirmy.Text;
            string column11 = TextBoxRegon.Text;

            using (var context = new BiuroPodrozyEntities())
            {
                try
                {
                    var aktualRecord  = context.Klienci.First(x => x.Id_klienta == int.Parse(recordToUpdate));
                    var updatedRecord = context.Klienci.First(x => x.Id_klienta == int.Parse(recordToUpdate));
                    updatedRecord.Imię         = column1;
                    updatedRecord.Nazwisko     = column2;
                    updatedRecord.Pesel        = column3;
                    updatedRecord.Adres        = column4;
                    updatedRecord.Miasto       = column5;
                    updatedRecord.Kod_pocztowy = column6;
                    updatedRecord.Kraj         = column7;
                    updatedRecord.Telefon      = column8;
                    updatedRecord.Email        = column9;
                    updatedRecord.Nazwa_firmy  = column10;
                    updatedRecord.Regon        = column11;
                    //aktualRecord = updatedRecord;
                    context.Klienci.Remove(aktualRecord);
                    context.Klienci.Add(updatedRecord);

                    context.SaveChanges();

                    MessageBox.Show("Dodano nowy rekord!");
                }
                catch (Exception)
                {
                    MessageBox.Show("Coś poszło nie tak!");
                }
            }
        }
        public void SetDataContextComboBoxSelected(MainWindow mainWindow)
        {
            Parameter parameterWindow;
            string    param;

            int choose = mainWindow.comboBox.SelectedIndex;

            using (var context = new BiuroPodrozyEntities())
            {
                switch (choose)
                {
                case 0:
                    mainWindow.viewModel.TableName    = ColumnNames.klienci;
                    mainWindow.viewModel.TableContent = context.Klienci.ToList();
                    mainWindow.TextBox1.Text          = mainWindow.TextBox2.Text = mainWindow.TextBox3.Text
                                                                                       = mainWindow.TextBox4.Text = mainWindow.TextBox5.Text = mainWindow.TextBox6.Text
                                                                                                                                                   = mainWindow.TextBox7.Text = mainWindow.TextBox8.Text = mainWindow.TextBox9.Text
                                                                                                                                                                                                               = mainWindow.TextBox10.Text = mainWindow.TextBox11.Text = "";
                    mainWindow.DataContext = mainWindow.viewModel;
                    break;

                case 1:
                    mainWindow.viewModel.TableName    = ColumnNames.uczestnicy;
                    mainWindow.viewModel.TableContent = context.Uczestnicy.ToList();
                    mainWindow.TextBox1.Text          = mainWindow.TextBox2.Text = mainWindow.TextBox3.Text
                                                                                       = mainWindow.TextBox4.Text = mainWindow.TextBox5.Text = mainWindow.TextBox6.Text
                                                                                                                                                   = mainWindow.TextBox7.Text = mainWindow.TextBox8.Text = mainWindow.TextBox9.Text
                                                                                                                                                                                                               = mainWindow.TextBox10.Text = mainWindow.TextBox11.Text = "";
                    mainWindow.DataContext = mainWindow.viewModel;
                    break;

                case 2:
                    mainWindow.viewModel.TableName    = ColumnNames.zamowienia;
                    mainWindow.viewModel.TableContent = context.Zamówienia.ToList();
                    mainWindow.TextBox1.Text          = mainWindow.TextBox2.Text = mainWindow.TextBox3.Text
                                                                                       = mainWindow.TextBox4.Text = mainWindow.TextBox5.Text = mainWindow.TextBox6.Text
                                                                                                                                                   = mainWindow.TextBox7.Text = mainWindow.TextBox8.Text = mainWindow.TextBox9.Text
                                                                                                                                                                                                               = mainWindow.TextBox10.Text = mainWindow.TextBox11.Text = "";
                    mainWindow.DataContext = mainWindow.viewModel;
                    break;

                case 3:
                    mainWindow.viewModel.TableName    = ColumnNames.wycieczki;
                    mainWindow.viewModel.TableContent = context.Wycieczki.ToList();
                    mainWindow.TextBox1.Text          = mainWindow.TextBox2.Text = mainWindow.TextBox3.Text
                                                                                       = mainWindow.TextBox4.Text = mainWindow.TextBox5.Text = mainWindow.TextBox6.Text
                                                                                                                                                   = mainWindow.TextBox7.Text = mainWindow.TextBox8.Text = mainWindow.TextBox9.Text
                                                                                                                                                                                                               = mainWindow.TextBox10.Text = mainWindow.TextBox11.Text = "";
                    mainWindow.DataContext = mainWindow.viewModel;
                    break;

                case 4:
                    mainWindow.viewModel.TableName    = ColumnNames.hotele;
                    mainWindow.viewModel.TableContent = context.Hotele.ToList();
                    mainWindow.TextBox1.Text          = mainWindow.TextBox2.Text = mainWindow.TextBox3.Text
                                                                                       = mainWindow.TextBox4.Text = mainWindow.TextBox5.Text = mainWindow.TextBox6.Text
                                                                                                                                                   = mainWindow.TextBox7.Text = mainWindow.TextBox8.Text = mainWindow.TextBox9.Text
                                                                                                                                                                                                               = mainWindow.TextBox10.Text = mainWindow.TextBox11.Text = "";
                    mainWindow.DataContext = mainWindow.viewModel;
                    break;

                case 5:
                    mainWindow.viewModel.TableName    = ColumnNames.rezydenci;
                    mainWindow.viewModel.TableContent = context.Rezydenci.ToList();
                    mainWindow.TextBox1.Text          = mainWindow.TextBox2.Text = mainWindow.TextBox3.Text
                                                                                       = mainWindow.TextBox4.Text = mainWindow.TextBox5.Text = mainWindow.TextBox6.Text
                                                                                                                                                   = mainWindow.TextBox7.Text = mainWindow.TextBox8.Text = mainWindow.TextBox9.Text
                                                                                                                                                                                                               = mainWindow.TextBox10.Text = mainWindow.TextBox11.Text = "";
                    mainWindow.DataContext = mainWindow.viewModel;
                    break;

                case 6:
                    mainWindow.viewModel.TableName    = ColumnNames.uslugi;
                    mainWindow.viewModel.TableContent = context.Usługi.ToList();
                    mainWindow.TextBox1.Text          = mainWindow.TextBox2.Text = mainWindow.TextBox3.Text
                                                                                       = mainWindow.TextBox4.Text = mainWindow.TextBox5.Text = mainWindow.TextBox6.Text
                                                                                                                                                   = mainWindow.TextBox7.Text = mainWindow.TextBox8.Text = mainWindow.TextBox9.Text
                                                                                                                                                                                                               = mainWindow.TextBox10.Text = mainWindow.TextBox11.Text = "";
                    mainWindow.DataContext = mainWindow.viewModel;
                    break;

                case 7:
                    mainWindow.viewModel.TableName    = ColumnNames.atrakcje;
                    mainWindow.viewModel.TableContent = context.Atrakcje.ToList();
                    mainWindow.TextBox1.Text          = mainWindow.TextBox2.Text = mainWindow.TextBox3.Text
                                                                                       = mainWindow.TextBox4.Text = mainWindow.TextBox5.Text = mainWindow.TextBox6.Text
                                                                                                                                                   = mainWindow.TextBox7.Text = mainWindow.TextBox8.Text = mainWindow.TextBox9.Text
                                                                                                                                                                                                               = mainWindow.TextBox10.Text = mainWindow.TextBox11.Text = "";
                    mainWindow.DataContext = mainWindow.viewModel;
                    break;

                case 8:
                    mainWindow.viewModel.TableContent = context.vRezydenciPodrozy.ToList();
                    mainWindow.TextBox1.Text          = mainWindow.TextBox2.Text = mainWindow.TextBox3.Text
                                                                                       = mainWindow.TextBox4.Text = mainWindow.TextBox5.Text = mainWindow.TextBox6.Text
                                                                                                                                                   = mainWindow.TextBox7.Text = mainWindow.TextBox8.Text = mainWindow.TextBox9.Text
                                                                                                                                                                                                               = mainWindow.TextBox10.Text = mainWindow.TextBox11.Text = "";
                    mainWindow.DataContext = mainWindow.viewModel;
                    break;

                case 9:
                    mainWindow.viewModel.TableContent = context.vIlośćWycieczek
                                                        .GroupBy(info => info.Kraj)
                                                        .Select(group => new
                    {
                        Metric = group.Key,
                        Count  = group.Count()
                    })
                                                        .OrderBy(x => x.Metric)
                                                        .ToList();
                    mainWindow.TextBox1.Text = mainWindow.TextBox2.Text = mainWindow.TextBox3.Text
                                                                              = mainWindow.TextBox4.Text = mainWindow.TextBox5.Text = mainWindow.TextBox6.Text
                                                                                                                                          = mainWindow.TextBox7.Text = mainWindow.TextBox8.Text = mainWindow.TextBox9.Text
                                                                                                                                                                                                      = mainWindow.TextBox10.Text = mainWindow.TextBox11.Text = "";
                    mainWindow.DataContext = mainWindow.viewModel;
                    break;

                case 10:
                    mainWindow.viewModel.TableContent = context.vTrwajaceWycieczki.ToList();
                    mainWindow.TextBox1.Text          = mainWindow.TextBox2.Text = mainWindow.TextBox3.Text
                                                                                       = mainWindow.TextBox4.Text = mainWindow.TextBox5.Text = mainWindow.TextBox6.Text
                                                                                                                                                   = mainWindow.TextBox7.Text = mainWindow.TextBox8.Text = mainWindow.TextBox9.Text
                                                                                                                                                                                                               = mainWindow.TextBox10.Text = mainWindow.TextBox11.Text = "";
                    mainWindow.DataContext = mainWindow.viewModel;
                    break;

                case 11:
                    parameterWindow = new Parameter("Rodzaj atrakcji");
                    parameterWindow.ShowDialog();
                    param = parameterWindow.parameter;

                    if (!string.IsNullOrWhiteSpace(param))
                    {
                        mainWindow.viewModel.TableContent = context.WycieczkiPoRodzajuAtrakcji(param).ToList();
                        mainWindow.DataContext            = mainWindow.viewModel;
                    }
                    break;

                case 12:
                    parameterWindow = new Parameter("Id wycieczki");
                    parameterWindow.ShowDialog();
                    param = parameterWindow.parameter;

                    if (!string.IsNullOrWhiteSpace(param))
                    {
                        mainWindow.viewModel.TableContent = context.UczestnicyWycieczki(int.Parse(param)).ToList();
                        mainWindow.DataContext            = mainWindow.viewModel;
                    }
                    break;

                case 13:
                    parameterWindow = new Parameter("Cena");
                    parameterWindow.ShowDialog();
                    param = parameterWindow.parameter;
                    if (!string.IsNullOrWhiteSpace(param))
                    {
                        mainWindow.viewModel.TableContent = context.WycieczkiDoCeny(decimal.Parse(param)).ToList();
                        mainWindow.DataContext            = mainWindow.viewModel;
                    }
                    break;

                case 14:
                    parameterWindow = new Parameter("Kraj");
                    parameterWindow.ShowDialog();
                    param = parameterWindow.parameter;

                    if (!string.IsNullOrWhiteSpace(param))
                    {
                        mainWindow.viewModel.TableContent = context.WycieczkiDoKraju(param).ToList();
                        mainWindow.DataContext            = mainWindow.viewModel;
                    }
                    break;

                default:
                    break;
                }
            }
        }