Пример #1
0
        private static void InsertToDatabase(IMongoCollection <EnergyDrink> collection)
        {
            Console.Clear();
            Console.Write("Enter the name of the drink:");
            var name = Console.ReadLine();

            Console.Write("\nEnter the price of the drink:");
            var price = double.Parse(Console.ReadLine());

            var energyDrink = new EnergyDrink(name, price);

            collection.InsertOneAsync(energyDrink);

            Console.WriteLine("The drink was successfuly added");
            Console.WriteLine("\nPress any key to continue..");
            Console.ReadLine();
        }
Пример #2
-1
        private static void InsertToDatabase(IMongoCollection<EnergyDrink> collection)
        {
            Console.Clear();
            Console.Write("Enter the name of the drink:");
            var name = Console.ReadLine();
            Console.Write("\nEnter the price of the drink:");
            var price = double.Parse(Console.ReadLine());

            var energyDrink = new EnergyDrink(name, price);
            collection.InsertOneAsync(energyDrink);

            Console.WriteLine("The drink was successfuly added");
            Console.WriteLine("\nPress any key to continue..");
            Console.ReadLine();
        }