public void Undo()
        {
            if (receiver == null)
            {
                Console.WriteLine($"No receiver supplied to {nameof(SubtractCommand)}");
                return;
            }

            receiver.Add(value);
            Log();
        }
        public void Execute()
        {
            if (receiver == null)
            {
                Console.WriteLine($"No receiver supplied to {nameof(AddCommand)}");
                return;
            }

            Log();
            receiver.Add(value);
        }
Example #3
0
        public void Execute()
        {
            switch (_operation)
            {
            case Operation.Add:
                _receiver.Add(_value);
                break;

            case Operation.Subtract:
                _receiver.Subtract(_value);
                break;

            case Operation.Multiply:
                _receiver.Multiply(_value);
                break;

            case Operation.Divide:
                _receiver.Divide(_value);
                break;
            }
        }