private void ReplenishInv(Location location) { List <Stock> inventory = _shopBL.GetInventory(location); Console.WriteLine($"\nDisplaying Inventory to update at store located at {location.City}, {location.State}:"); int i = 0; foreach (Stock stock in inventory) { Console.WriteLine("[" + ++i + "] " + stock.ToString()); } bool repeat = true; do { Console.WriteLine("Select an item to replenish. Otherwise type [0] to go back."); string input = Console.ReadLine(); int n; if (int.TryParse(input, out n)) { if (n == 0) { repeat = false; return; } else if (n > 0 && n <= inventory.Count) { Log.Information($"Selected color {inventory[n - 1].Product.Name}"); bool repeat2 = true; do { Console.WriteLine($"Input how much of color {inventory[n - 1].Product.Name} you would like to add? Otherwise type [0] to go back."); string quantity = Console.ReadLine(); int num; if (int.TryParse(quantity, out num)) { if (num == 0) { repeat2 = false; return; } if (num > 0) { Log.Information($"Selected to add {num} of stock to inventory"); // add to stock Stock addedStock = _shopBL.AddStock(inventory[n - 1], location, num); if (addedStock == null) { Console.WriteLine("Inventory could not be updated. (Server side error)"); } else { Console.WriteLine($"Successfully updated stock for color {inventory[n - 1].Product.Name}"); } return; } } Console.WriteLine("Invalid input"); } while (repeat2); } else { Console.WriteLine("Invalid input"); } } else { Console.WriteLine("Invalid input"); } } while (repeat); }