forked from ddrilling/AsbCloudServer
Fix TelemetryWirelineRunOut. AddOrUpdateAsync issue
This commit is contained in:
parent
f7654a95b6
commit
4dced662e1
@ -34,15 +34,11 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
var idTelemetry = telemetryService.GetOrCreateTelemetryIdByUid(uid);
|
var idTelemetry = telemetryService.GetOrCreateTelemetryIdByUid(uid);
|
||||||
var timezoneOffset = telemetryService.GetTimezone(idTelemetry).Hours;
|
var timezoneOffset = telemetryService.GetTimezone(idTelemetry).Hours;
|
||||||
var entity = Convert(idTelemetry, dto, timezoneOffset);
|
var entity = Convert(idTelemetry, dto, timezoneOffset);
|
||||||
|
|
||||||
var updatingItem = context.TelemetryWirelineRunOut
|
if (await context.TelemetryWirelineRunOut.AnyAsync(w => w.IdTelemetry == idTelemetry, token))
|
||||||
.Where(x => x.IdTelemetry == idTelemetry)
|
|
||||||
.FirstOrDefault();
|
|
||||||
|
|
||||||
if (updatingItem is null)
|
|
||||||
context.TelemetryWirelineRunOut.Add(entity);
|
|
||||||
else
|
|
||||||
context.TelemetryWirelineRunOut.Update(entity);
|
context.TelemetryWirelineRunOut.Update(entity);
|
||||||
|
else
|
||||||
|
context.TelemetryWirelineRunOut.Add(entity);
|
||||||
|
|
||||||
return await context.SaveChangesAsync(token);
|
return await context.SaveChangesAsync(token);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user