Beispiel #1
0
        private static void AddNewRecord(CarRepository destination)
        {
            Console.WriteLine("Dodawanie nowego rekordu");

            Console.Write("Podaj producenta: ");
            string manufacturer = Console.ReadLine();

            Console.Write("Podaj model: ");
            string model = Console.ReadLine();

            Console.Write("Podaj pojemnosc: ");
            string capacity = Console.ReadLine();

            //validate all attributes
            if (CarValidator.IsManufacturerValid(manufacturer) && CarValidator.IsModelValid(model) && CarValidator.IsCapacityValid(capacity))
            {
                destination.AddToBuffer(new Car(manufacturer, model, Convert.ToDouble(capacity.Replace(",", "."), new CultureInfo("en-US"))));
                Console.WriteLine("Rekord dodany do bufora.");
            }
            else
            {
                Console.WriteLine("Nie mozna dodac rekordu. Nie wszystkie dane sa poprawne.");
            }
        }