public void SetState(Guid externalId, CommandStateType businessState, string details) { var dataState = MappingEngine.Map<CommandStateType, DataEntities.ExecPoll.CommandStateType>(businessState); CommandExecution command = CommandRepository.GetSatisfiedBy(p => p.ExternalId == externalId); if(command == null) throw new CommandExecutionNotFoundException(externalId); var newEntry = new CommandHistory { CommandExecutionId = command.CommandExecutionId, State = dataState, Details = details }; CommandHistoryRepository.Insert(newEntry); }
public void Create(Guid externalId, string description) { var command = new CommandExecution { ExternalId = externalId, Description = description, }; CommandRepository.Insert(command); var newEntry = new CommandHistory { CommandExecutionId = command.CommandExecutionId, State = DataEntities.ExecPoll.CommandStateType.Waiting, }; CommandHistoryRepository.Insert(newEntry); }