public void RemovePizza(APizza pizza) { if (pizza.GetType() == typeof(PrebuiltPizza)) { if (PrebuiltPizzas.Exists(p => p.ID == pizza.ID)) { PrebuiltPizzas.Remove((PrebuiltPizza)pizza); } else { Logger.Instance.LogError("Tried to RemovePizza() a " + pizza.Name + " that did not exist in order " + OrderID); } } else if (pizza.GetType() == typeof(CustomPizza)) { if (CustomPizzas.Exists(p => p.ID == pizza.ID)) { CustomPizzas.Remove((CustomPizza)pizza); } else { Logger.Instance.LogError("Tried to RemovePizza() a pizza" + pizza.Name + " that did not exist in order " + OrderID); } } else { Logger.Instance.LogError("Tried to RemovePizza() a " + pizza.GetType() + ", instead of a pizza type."); } }
public void AddPizza(APizza pizza) { if (pizza.GetType() == typeof(PrebuiltPizza)) { PrebuiltPizzas.Add((PrebuiltPizza)pizza); } else if (pizza.GetType() == typeof(CustomPizza)) { CustomPizzas.Add((CustomPizza)pizza); } }