public void UndoCommand() { ICommand lastComand = new StockItemIncrease(null, 0); if ((_stockOperations.Count - 1) >= 0) { lastComand = _stockOperations[_stockOperations.Count - 1]; lastComand.Undo(); _stockOperations.RemoveAt(_stockOperations.Count - 1); _redoStockOperations.Add(lastComand); } }
public void RedoCommand() { ICommand lastComand = new StockItemIncrease(null, 0); Console.WriteLine($"aa {_redoStockOperations.Count}"); if ((_redoStockOperations.Count) > 0) { lastComand = _redoStockOperations[_redoStockOperations.Count - 1]; _stockOperations.Add(lastComand); _redoStockOperations.RemoveAt(_redoStockOperations.Count - 1); lastComand.Execute(); } }