public virtual void LoadSnacks(int position, SnackPile snackPile) { Slot slot = Slots.Single(x => x.Position == position); //slot.Snack = snack; //slot.Quantity = quantity; //slot.Price = price; slot.SnackPile = snackPile; }
// solution for client errors display public virtual string CanBuySnack(int position) { SnackPile snackPile = GetSnackPile(position); if (snackPile.Quantity == 0) { return("The snack pile is empty"); } if (MoneyInTransaction < snackPile.Price) { return("Not enough money"); } if (!MoneyInside.CanAllocate(MoneyInTransaction - snackPile.Price)) { return("Not enough change"); } return(string.Empty); }
public virtual void LoadSnacks(int position, SnackPile snackPile) { GetSlot(position).SnackPile = snackPile; }