public void Inventory() { using IPizzaboxRepository pizzaboxRepository = DbOptions.CreatePizzaboxRepository(); string locationid = ""; int tried = trials = 3; int id = 0; do { Console.WriteLine("Please select your location:"); int count = Locations(); Console.Write("Store ID (enter digit): "); locationid = Console.ReadLine(); Console.Clear(); if (int.TryParse(locationid, out id)) { if (id < 1 || id > count) { if (trials > 1) { Console.WriteLine("Please enter a digit according to store IDs displayed below:"); trials--; } else { Console.WriteLine("You have failed to identify your shop " + tried + " times."); Exit(); return; } } else { break; } } } while (trials > 0); var query = pizzaboxRepository.GetInventoryByStore(id); var store = pizzaboxRepository.GetStoreById(id); if (query == null) { if (store == null) { Console.WriteLine("There is no such store."); return; } Console.WriteLine("Inventory at location #" + store.StoreId + " is currently unavailable. Please contact your administrator."); return; } Console.WriteLine("Store #" + id.ToString().PadLeft(12 - id.ToString().Length, '0')); Console.WriteLine("Has enough ingredients for " + query.Preset + " Presets"); Console.WriteLine("Has enough ingredients for " + query.Custom + " Customs"); Console.WriteLine(); }