/// <summary> /// 用drinkIndex找要加"加料"的飲料,把加料加進去 /// </summary> /// <param name="drinkIndex"></param> /// <param name="addition"></param> public bool AddDrinkAddition(int drinkIndex, DrinkAddition addition) { if (drinkIndex < _orderList.Count && drinkIndex >= 0) { return(_orderList[drinkIndex].AddAddition(addition)); } return(false); }
/// <summary> /// 增加加料 /// </summary> /// <param name="addition"></param> public bool AddAddition(DrinkAddition addition) { string totalAddition = GetAdditionName(); if (totalAddition.Contains(addition.Name)) { return(false); } _additionList.Add(addition); return(true); }
//Add Drink public void AddDrinkAddition(DrinkAddition addition) { _drinkAddition.Add(addition); _totalPrice += addition.price; }
//Remove Addition public void RemoveAddition(DrinkAddition addition) { _drinkAddition.RemoveAll(item => object.ReferenceEquals(item, addition)); }