Example #1
0
        public static void SelectedService(int serviceId)
        {
            ProductManager productManager = new ProductManager();

            if (serviceId == 1)
            {
                Console.Write("Enter product id: ");
                int productId = ConsoleInputValidator.ServiceInputValidator(serviceId);
                int quantity  = ConsoleInputValidator.QuantityInputValidator(serviceId);

                if (_cartManager.Retrieve(productId) != null)
                {
                    _cartManager.Update(_cartManager.Retrieve(productId), serviceId, quantity);
                }
                else
                {
                    _cartManager.Add(productManager.Retrieve(productId), quantity);
                }

                DisplayHandler.DisplayService();
            }
            else if (serviceId == 2)
            {
                Console.Write("Choose which ID to decrease/remove: ");
                int productId = ConsoleInputValidator.ServiceInputValidator(serviceId);
                int quantity  = ConsoleInputValidator.QuantityInputValidator(serviceId);

                _cartManager.Update(_cartManager.Retrieve(productId), serviceId, quantity);

                DisplayHandler.DisplayService();
            }
            else if (serviceId == 3)
            {
                Console.Write("Please enter cash on hand: ");
                ConsoleInputValidator.ServiceInputValidator(serviceId);

                DoTransactionAgain();
            }
        }