Ejemplo n.º 1
0
        public async Task <IActionResult> EditProfile(string id, EditHardwareVaultProfileDto profileDto)
        {
            if (id != profileDto.Id)
            {
                return(BadRequest());
            }

            try
            {
                var profile = new HardwareVaultProfile()
                {
                    Id                     = profileDto.Id,
                    Name                   = profileDto.Name,
                    ButtonPairing          = profileDto.ButtonBonding,
                    ButtonConnection       = profileDto.ButtonConnection,
                    ButtonStorageAccess    = profileDto.ButtonNewChannel,
                    PinPairing             = profileDto.PinBonding,
                    PinConnection          = profileDto.PinConnection,
                    PinStorageAccess       = profileDto.PinNewChannel,
                    MasterKeyConnection    = profileDto.MasterKeyConnection,
                    MasterKeyStorageAccess = profileDto.MasterKeyNewChannel,
                    PinExpiration          = profileDto.PinExpiration,
                    PinLength              = profileDto.PinLength,
                    PinTryCount            = profileDto.PinTryCount
                };
                await _hardwareVaultService.EditProfileAsync(profile);

                _remoteDeviceConnectionsService.StartUpdateHardwareVaultAccounts(await _hardwareVaultService.GetVaultIdsByProfileTaskAsync());
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                return(StatusCode(500, new { error = ex.Message }));
            }

            return(NoContent());
        }