public List <rejestr> DodajUzytkwnika(List <rejestr> lista)
        {
            string imie;
            string nazwisko;
            int    wiek;
            char   plec;
            int    kod_pocztowy;
            string miasto;
            string ulica;
            int    nr_domu;
            int    nr_mieszkania;
            string kod;
            string plec_string;

            Console.Clear();
            Console.WriteLine("Podaj imię!");
            imie = Console.ReadLine();
            Console.WriteLine("Podaj nazwisko!");
            nazwisko = Console.ReadLine();
            do
            {
                Console.WriteLine("Podaj wiek!");
            }while (!int.TryParse(Console.ReadLine(), out wiek) || wiek < 1 || wiek > 100);
            bool sprawdzenie = true;

            do
            {
                Console.WriteLine("Podaj płeć[k/m]!");
                plec_string = Console.ReadLine();

                if (plec_string.ToLower() == "k")
                {
                    sprawdzenie = false;
                }
                else if (plec_string.ToLower() == "m")
                {
                    sprawdzenie = false;
                }
            }while (sprawdzenie);
            plec = Convert.ToChar(plec_string);
            do
            {
                Console.WriteLine("Podaj kod pocztowy[tylko cyfry]!");
                kod = Console.ReadLine();
            }while (!int.TryParse(kod, out kod_pocztowy) || kod.Length != 5);
            Console.WriteLine("Podaj Miasto!");
            miasto = Console.ReadLine();
            Console.WriteLine("Podaj ulicę!");
            ulica = Console.ReadLine();
            do
            {
                Console.WriteLine("Podaj nr domu!");
            }while (!int.TryParse(Console.ReadLine(), out nr_domu) || nr_domu < 1);
            do
            {
                Console.WriteLine("Podaj nr mieszkania[jeśli nie ma to wpisujemy 0]!");
            }while (!int.TryParse(Console.ReadLine(), out nr_mieszkania) || nr_mieszkania < 0);
            int     id = (lista[lista.Count - 1].ID + 1);
            rejestr u  = new rejestr((id), imie, nazwisko, wiek, plec, kod_pocztowy, miasto, ulica, nr_domu, nr_mieszkania);

            lista.Add(u);
            Console.Clear();
            Console.WriteLine("Użytkownik został dodany pomyślnie!");
            Thread.Sleep(3000);
            Console.Clear();
            return(lista);
        }
        public List <rejestr> EdycjaUzytkownika(List <rejestr> lista)
        {
            Console.Clear();
            int pid;

            do
            {
                Console.WriteLine("Podaj id uzytkownika, którego chcesz edytowac");
            }while (!int.TryParse(Console.ReadLine(), out pid));
            for (int i = 0; i < lista.Count; i++)
            {
                if (lista[i].ID == pid)
                {
                    string imie;
                    string nazwisko;
                    int    wiek;
                    char   plec;
                    int    kod_pocztowy;
                    string miasto;
                    string ulica;
                    int    nr_domu;
                    int    nr_mieszkania;
                    string kod;
                    string plec_string;

                    Console.WriteLine("Podaj imię!");
                    imie = Console.ReadLine();
                    Console.WriteLine("Podaj nazwisko!");
                    nazwisko = Console.ReadLine();
                    do
                    {
                        Console.WriteLine("Podaj wiek!");
                    }while (!int.TryParse(Console.ReadLine(), out wiek) || wiek < 1 || wiek > 100);
                    do
                    {
                        Console.WriteLine("Podaj płeć!");
                        plec_string = Console.ReadLine();
                    }while (plec_string.Length != 1 || plec_string != "k" /*|| plec_string != "K" || plec_string != "m" || plec_string != "M"*/);
                    plec = Convert.ToChar(plec_string);
                    do
                    {
                        Console.WriteLine("Podaj kod pocztowy!");
                        kod = Console.ReadLine();
                    }while (!int.TryParse(kod, out kod_pocztowy) || kod.Length != 5);
                    Console.WriteLine("Podaj Miasto!");
                    miasto = Console.ReadLine();
                    Console.WriteLine("Podaj ulicę!");
                    ulica = Console.ReadLine();
                    do
                    {
                        Console.WriteLine("Podaj nr domu!");
                    }while (!int.TryParse(Console.ReadLine(), out nr_domu) || nr_domu < 1);
                    do
                    {
                        Console.WriteLine("Podaj nr mieszkania!");
                    }while (!int.TryParse(Console.ReadLine(), out nr_mieszkania) || nr_mieszkania < 0);

                    rejestr nowy = new rejestr((i + 1), imie, nazwisko, wiek, plec, kod_pocztowy, miasto, ulica, nr_domu, nr_mieszkania);
                    lista[i] = nowy;
                    Console.Clear();
                    Console.WriteLine("Edycja przbiegla pomyślnie");
                    Thread.Sleep(3000);
                    Console.Clear();
                    return(lista);
                }
                else
                {
                    Console.Clear();
                    Console.WriteLine("Podane ID nie istnieje");
                    Thread.Sleep(3000);
                    Console.Clear();
                    return(lista);
                }
            }
            return(lista);
        }