public void AddSaltedPlate(SaltedPlate plate, int quantity) { bool res = this.m_saltedPlates.ContainsKey(plate); if (res) { m_saltedPlates[plate] += quantity; } else { this.m_saltedPlates.Add(plate, quantity); } }
static void Main(string[] args) { Client client = new Client("samuel", "benibgui", "0000000", "*****@*****.**"); DateTime date = DateTime.Today.AddDays(1); Order order = new Order(client, date); for (int i = 0; i < 10; ++i) { SweetedPlate plate = new SweetedPlate("Coco Passion", 10, 3, "Joyeux Anniversaire"); order.AddSweetPlate(plate); } for (int i = 0; i < 10; ++i) { SaltedPlate plate = new SaltedPlate("fricasser", 30.0); order.AddSaltedPlate(plate, i); } Console.Write(order.ToString()); }