/// <summary>
        /// Method for managers see the inventory of the location
        /// </summary>
        public void viewInventory()
        {
            string inventoryInput;
            string amount;

            do
            {
                List <models.Inventory> currentInventory = inventoryService.GetInventoriesByLocationId(manager.LocationId);
                Console.WriteLine("\nSelect which product to replenish");
                foreach (var i in currentInventory)
                {
                    models.Product product = productService.GetProductById(i.ProductId);
                    Console.WriteLine($"Id: {product.Id}.\t Name: {product.GameName}, Price: {product.Price}, Quantity: {i.Quantity}");
                }

                Console.WriteLine("Press [0] to go back.");

                inventoryInput = Console.ReadLine();

                if (inventoryInput.Equals("0"))
                {
                    break;
                }

                models.Product selectedProduct = productService.GetProductById(int.Parse(inventoryInput));

                Console.WriteLine($"\nPlease enter how many game's of {selectedProduct.GameName} you would like to add to inventory");

                amount = Console.ReadLine();

                inventoryService.AddToInventory(manager.LocationId, selectedProduct.Id, int.Parse(amount));
            } while(!inventoryInput.Equals("0"));
        }
예제 #2
0
        /// <summary>
        /// Method to select a Product from Inventory
        /// </summary>
        public void Inventory()
        {
            string inventoryInput;

            do
            {
                Console.WriteLine("\nSelect a Product");
                List <models.Inventory> items = inventoryService.GetInventoriesByLocationId(int.Parse(userInputLocation));
                foreach (var i in items)
                {
                    models.Product product = productService.GetProductById(i.ProductId);
                    Console.WriteLine($"Id: {product.Id}.\t Name: {product.GameName}, Price: {product.Price}, Quantity: {i.Quantity}");
                }
                Console.WriteLine("Press [0] to go back.");

                inventoryInput = Console.ReadLine();

                if (inventoryInput.Equals("0"))
                {
                    break;
                }

                selectedProduct = productService.GetProductById(int.Parse(inventoryInput));


                Log.Information($"User Chose Item: {selectedProduct.GameName}");

                NewOrder();
                Log.Information("User Made Order");
                // Ask to show orders
                ChooseMenu();
            } while (!inventoryInput.Equals("0"));
        }