public bool RemoveFruitItemFromBasket(FruitItem fruitItem) { bool result = false; result = _fruitBasketRepository.Remove(fruitItem); return(result); }
public bool AddFruitToBasket(FruitItem fruitItem) { bool result = false; result = _fruitBasketRepository.Add(fruitItem); return(result); }
private static void AddFruit(FruitItem fruitItem) { if (_fruitBasketService.AddFruitToBasket(fruitItem)) { PrintToScreen(string.Format("Added the following fruit item: {0}", fruitItem.Name)); } else { PrintToScreen(string.Format("The following fruit item already exists and cannot be added: {0}", fruitItem.Name)); } }
private static void RemoveFruit(FruitItem fruitItem) { if (_fruitBasketService.RemoveFruitItemFromBasket(fruitItem)) { PrintToScreen(string.Format("Removed the following fruit item: {0}", fruitItem.Name)); } else { PrintToScreen(string.Format("The following fruit item is not in the basket and cannot be removed: {0}", fruitItem.Name)); } }
bool IStateContext <FruitBasket> .CanBeRemoved(FruitItem fruitItem) { return(_currentContext.Items.ContainsKey(fruitItem.Key)); }