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)
|
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;
|
return null;
|
||||||
|
|
||||||
var dto = wellInfoService.FirstOrDefault(well => well.Id == idWell);
|
var wellInfo = wellInfoService.FirstOrDefault(well => well.Id == idWell);
|
||||||
|
|
||||||
if (dto is null)
|
if (wellInfo is null)
|
||||||
return entity.Adapt<WellMapInfoWithTelemetryStat>();
|
return well.Adapt<WellMapInfoWithTelemetryStat>();
|
||||||
|
|
||||||
dto.IdState = entity.IdState;
|
wellInfo.IdState = well.IdState;
|
||||||
return dto;
|
return wellInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<WellDto>> GetAsync(WellRequest request, CancellationToken token)
|
public async Task<IEnumerable<WellDto>> GetAsync(WellRequest request, CancellationToken token)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using AsbCloudApp.Data;
|
using AsbCloudApp.Data;
|
||||||
|
using AsbCloudApp.Exceptions;
|
||||||
using AsbCloudApp.Services;
|
using AsbCloudApp.Services;
|
||||||
using AsbCloudDb.Model;
|
using AsbCloudDb.Model;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
@ -136,7 +137,11 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
var dto = await wellService.GetOrDefaultAsync(idWell, token);
|
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)
|
var result = await wellService.UpdateAsync(dto, token)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user