public Order CreateOrder() { Order order = new Order(this); while (true) { ViewProductsList(); Console.WriteLine("Select the ID of the product you want to order:"); string id = Console.ReadLine(); for (int i = 0; i < ProductsLocalDB.GetProducts.Count; i++) { if (id == Convert.ToString(ProductsLocalDB.GetProducts[i].ID)) { order.AddProduct((ProductsLocalDB.GetProducts[i])); Console.WriteLine("Product ordered successfully"); break; } else if (i == ProductsLocalDB.GetProducts.Count - 1 && id != Convert.ToString(ProductsLocalDB.GetProducts[i].ID)) { Console.WriteLine("There is no product with this ID"); } } Console.WriteLine(); Console.WriteLine("Press 0 to exit order creation"); if (Console.ReadLine() == "0") { OrderLocalDB.Add(order, OrderLocalDB.GetOrders.Count + 1); break; } } return(order); }