Пример #1
0
        public static int ForMedicineId(string message)
        {
            bool exists;
            int  id;
            int  count = 0;

            do
            {
                id     = ForInt(message);
                exists = Medicine.CheckIfExists(id);

                if (exists)
                {
                    //break;
                    return(id);
                }

                ConsoleEx.Write(ConsoleColor.Red, "Lek o podanym ID nie istnieje\n");

                count++;

                if (count >= 2)
                {
                    if (Ask.ForBool("Wyświetlić wszystkie leki: t/n "))
                    {
                        Console.WriteLine();
                        ProgramLogic.DisplayMedicineList(Medicine.LoadAll());
                        Console.WriteLine();
                    }

                    count = 0;
                }
            } while (!exists);

            return(id);
        }