diff --git a/AsbCloudInfrastructure/Services/WellService.cs b/AsbCloudInfrastructure/Services/WellService.cs index 97bf9e06..1a907725 100644 --- a/AsbCloudInfrastructure/Services/WellService.cs +++ b/AsbCloudInfrastructure/Services/WellService.cs @@ -105,18 +105,17 @@ namespace AsbCloudInfrastructure.Services public async Task GetOrDefaultStatAsync(int idWell, CancellationToken token) { - var dto = wellInfoService.FirstOrDefault(well => well.Id == idWell); - if (dto is not null) - return dto; - - var request = new WellRequest{Ids = new[] { idWell }}; - var entities = await GetEntitiesAsync(request, token); - var entity = entities.FirstOrDefault(); + var entity = await GetOrDefaultAsync(idWell, token); + if (entity is null) return null; + + var dto = wellInfoService.FirstOrDefault(well => well.Id == idWell); - dto = entity.Adapt(); - + if (dto is null) + return entity.Adapt(); + + dto.IdState = entity.IdState; return dto; }