예제 #1
0
        public async Task<IActionResult> EditHardwareVaultRfid(string id, EditHardwareVaultRfidDto vaultDto)
        {
            if (id != vaultDto.Id)
            {
                return BadRequest();
            }

            try
            {
                var vault = new HardwareVault()
                {
                    Id = vaultDto.Id,
                    RFID = vaultDto.RFID
                };

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

            return NoContent();
        }
예제 #2
0
        public async Task EditRfidAsync()
        {
            var hardwareVault = _testingOptions.HardwareVault;

            hardwareVault.RFID = _testingOptions.NewHardwareVaultRFID;

            await _hardwareVaultService.UpdateRfidAsync(hardwareVault);

            var result = await _hardwareVaultService.GetVaultByIdAsync(_testingOptions.HardwareVaultId);

            Assert.NotNull(result);
            Assert.Equal(_testingOptions.HardwareVaultId, result.Id);
            Assert.Equal(hardwareVault.RFID, result.RFID);
        }