From 4f4556b62b3821d408e610b6faea15144b5eed45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Tue, 17 Oct 2023 12:13:00 +0500 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=20=D0=BF=D0=BE=D0=BB?= =?UTF-8?q?=D1=83=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=81=D1=82=D0=B0=D1=82?= =?UTF-8?q?=D1=83=D1=81=D0=B0=20=D1=81=D0=BA=D0=B2=D0=B0=D0=B6=D0=B8=D0=BD?= =?UTF-8?q?=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudInfrastructure/Services/WellService.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) 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; }