forked from ddrilling/AsbCloudServer
Well service rename some variables
This commit is contained in:
parent
be585d8c85
commit
e9b79bb0d6
@ -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)
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user