public void Handle(EjectCan can) { var found = _dataAccessLayer.GetAll().FirstOrDefault(item => item.Flavour == can.Flavour); if (found != null) { _dataAccessLayer.AddorUpdate(new CanItem(found.Flavour, found.Quantity - 1, found.Price)); } }
public void Handle(AddStock can) { if (_dataAccessLayer.GetAll().ToList().Count == 10) { return; } _dataAccessLayer.AddorUpdate(new CanItem(can.Flavour, can.Quantity, can.Price)); }