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)); }
public void Handle(DeleteStock can) { var found = _dataAccessLayer.GetAll().FirstOrDefault(item => item.Flavour == can.Flavour); if (found == null) { return; } _dataAccessLayer.Delete(can.Flavour); }
public GetAllStockResponse Read(GetAllStock query) { return(new GetAllStockResponse(_dataAccessLayer.GetAll().OrderBy(item => item.Flavour))); }
public GetPriceByFlavourResponse Read(GetPriceByFlavour query) { var found = _dataAccessLayer.GetAll().FirstOrDefault(item => item.Flavour == query.Flavour); return(new GetPriceByFlavourResponse(found?.Price)); }