Well service rename some variables

This commit is contained in:
Frolov-Nikita 2023-10-22 17:57:39 +05:00
parent be585d8c85
commit e9b79bb0d6
No known key found for this signature in database
GPG Key ID: 719E3386D12B0760
2 changed files with 13 additions and 8 deletions

View File

@ -106,18 +106,18 @@ namespace AsbCloudInfrastructure.Services
public async Task<WellMapInfoWithTelemetryStat?> GetOrDefaultStatAsync(int idWell, CancellationToken token)
{
var entity = await GetOrDefaultAsync(idWell, token);
var well = await GetOrDefaultAsync(idWell, token);
if (entity is null)
if (well is null)
return null;
var dto = wellInfoService.FirstOrDefault(well => well.Id == idWell);
var wellInfo = wellInfoService.FirstOrDefault(well => well.Id == idWell);
if (dto is null)
return entity.Adapt<WellMapInfoWithTelemetryStat>();
if (wellInfo is null)
return well.Adapt<WellMapInfoWithTelemetryStat>();
dto.IdState = entity.IdState;
return dto;
wellInfo.IdState = well.IdState;
return wellInfo;
}
public async Task<IEnumerable<WellDto>> GetAsync(WellRequest request, CancellationToken token)

View File

@ -1,4 +1,5 @@
using AsbCloudApp.Data;
using AsbCloudApp.Exceptions;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
using Microsoft.AspNetCore.Authorization;
@ -136,7 +137,11 @@ namespace AsbCloudWebApi.Controllers
return Forbid();
var dto = await wellService.GetOrDefaultAsync(idWell, token);
dto!.IdState = idState;
if (dto is null)
return this.ValidationBadRequest(nameof(idWell), $"Скважина с id: {idWell} недоступна");
dto.IdState = idState;
var result = await wellService.UpdateAsync(dto, token)
.ConfigureAwait(false);