完成更新设备的测试

This commit is contained in:
2025-07-24 18:52:29 +08:00
parent 7b9c91eee1
commit 899e657053
5 changed files with 42 additions and 12 deletions

View File

@@ -119,8 +119,9 @@ public class DeviceService : IDeviceAppService
/// <summary>
/// 异步更新一个已存在的设备。
/// </summary>
public async Task UpdateDeviceAsync(UpdateDeviceDto deviceDto)
public async Task<int> UpdateDeviceAsync(UpdateDeviceDto deviceDto)
{
await _repoManager.BeginTranAsync();
var device = await _repoManager.Devices.GetByIdAsync(deviceDto.Id);
if (device == null)
{
@@ -128,8 +129,9 @@ public class DeviceService : IDeviceAppService
}
_mapper.Map(deviceDto, device);
await _repoManager.Devices.UpdateAsync(device);
int res=await _repoManager.Devices.UpdateAsync(device);
await _repoManager.CommitAsync();
return res;
}
/// <summary>