public Order(string OrdreDate, int Quantity, Customer Customer, Product Product) { this.OrdreDate = OrdreDate; QuantityOrdered = Quantity; OrderedBy = Customer; OrderedProduct = Product; }
internal void addProduct() { int number; float price; string name; try_again: try { Console.Clear(); Console.WriteLine("Write the ID"); number = int.Parse(Console.ReadLine()); Console.WriteLine("Write the name"); name = Console.ReadLine(); Console.WriteLine("Write the price"); price = float.Parse(Console.ReadLine()); Console.Clear(); } catch (Exception) { goto try_again; } Product ps = new Product(number, name, price); List<Product> productList = per.ProductList; foreach (var item in productList) { if (item.Itemnr1 == ps.Itemnr1) { goto try_again; } } per.addProduct(ps); Console.WriteLine("Press enter to continue"); Console.Read(); }