private void ExecuteAboutDataCommand(CommandDto commandDto) { if (commandDto.CommandType == CommandTypes.ADD) { ICommandAdd command = new AddAboutDataCommand(_loggerFactory, commandDto); command.Execute(_context); _commandDataAccessProvider.AddCommand(CommandEntity.CreateCommandEntity(commandDto)); _commandDataAccessProvider.Save(); command.UpdateIdforNewItems(); _undocommands.Push(command); } if (commandDto.CommandType == CommandTypes.UPDATE) { ICommand command = new UpdateAboutDataCommand(_loggerFactory, commandDto); command.Execute(_context); _commandDataAccessProvider.AddCommand(CommandEntity.CreateCommandEntity(commandDto)); _commandDataAccessProvider.Save(); _undocommands.Push(command); } if (commandDto.CommandType == CommandTypes.DELETE) { ICommand command = new DeleteAboutDataCommand(_loggerFactory, commandDto); command.Execute(_context); _commandDataAccessProvider.AddCommand(CommandEntity.CreateCommandEntity(commandDto)); _commandDataAccessProvider.Save(); _undocommands.Push(command); } }
// TODO add return object for UI public CommandDto Redo() { var commandDto = new CommandDto(); commandDto.CommandType = CommandTypes.REDO; commandDto.PayloadType = PayloadTypes.NONE; commandDto.ActualClientRoute = "NONE"; if (_redocommands.Count > 0) { ICommand command; if (_redocommands.TryPop(out command)) { _undocommands.Push(command); command.Execute(_context); commandDto.Payload = command.ActualCommandDtoForNewState(CommandTypes.REDO).Payload; _commandDataAccessProvider.AddCommand(CommandEntity.CreateCommandEntity(commandDto)); _commandDataAccessProvider.Save(); return(command.ActualCommandDtoForNewState(CommandTypes.REDO)); } } return(commandDto); }
private void ExecuteNoDataCommand(CommandDto commandDto) { _commandDataAccessProvider.AddCommand(CommandEntity.CreateCommandEntity(commandDto)); _commandDataAccessProvider.Save(); }