private async Task SetEnigmaMachineConfiguration(string userId) { var configuration = await enigmaMachineConfigurationPort .GetEnigmaMachineConfiguration(userId); if (configuration != null) { enigmaMachine.SetupRotors(mapper.Map <RotorsConfigurationSetup>(configuration)); enigmaMachine.SetupReflector(configuration.Reflector); enigmaMachine.SetupPlugboard(configuration.PlugboardMap); } }
public async Task <EnigmaMachineConfigurationModel> GetEnigmaMachineConfiguration(string userId) { EnigmaMachineConfigurationModel model = null; try { var configuration = await enigmaMachineConfigurationPort .GetEnigmaMachineConfiguration(userId); model = mapper.Map <EnigmaMachineConfigurationModel>(configuration); } catch (Exception exception) { logger.LogError(exception, $"An error has occured while trying to get machine configuation for user id: {userId}"); } return(model); }