CS2-50: Changed some .SaveChanges() to .SaveChangesAsync()

This commit is contained in:
KharchenkoVV 2021-08-11 17:41:51 +05:00
parent c7b87a1104
commit fe5eb39000
4 changed files with 7 additions and 7 deletions

View File

@ -12,7 +12,7 @@ namespace AsbCloudApp.Services
double intervalSec = 600d, int approxPointsCount = 1024, double intervalSec = 600d, int approxPointsCount = 1024,
CancellationToken token = default); CancellationToken token = default);
Task UpdateDataAsync(string uid, IEnumerable<DataSaubBaseDto> dtos, Task<int> UpdateDataAsync(string uid, IEnumerable<DataSaubBaseDto> dtos,
CancellationToken token); CancellationToken token);
Task<DatesRangeDto> GetDataDatesRangeAsync(int idWell, Task<DatesRangeDto> GetDataDatesRangeAsync(int idWell,
CancellationToken token); CancellationToken token);

View File

@ -7,7 +7,7 @@ namespace AsbCloudApp.Services
{ {
Task<Tdto> GetAsync(int idWell, int idCategory, Task<Tdto> GetAsync(int idWell, int idCategory,
CancellationToken token); CancellationToken token);
Task UpsertAsync(int idWell, int idCategory, Tdto value, Task<int> UpsertAsync(int idWell, int idCategory, Tdto value,
CancellationToken token); CancellationToken token);
} }
} }

View File

@ -73,11 +73,11 @@ namespace AsbCloudInfrastructure.Services
return dtos; return dtos;
} }
public async Task UpdateDataAsync(string uid, IEnumerable<DataSaubBaseDto> dtos, public async Task<int> UpdateDataAsync(string uid, IEnumerable<DataSaubBaseDto> dtos,
CancellationToken token = default) CancellationToken token = default)
{ {
if (dtos == default || !dtos.Any()) if (dtos == default || !dtos.Any())
return; return 0;
var telemetryId = telemetryService.GetOrCreateTemetryIdByUid(uid); var telemetryId = telemetryService.GetOrCreateTemetryIdByUid(uid);
var dtoMinDate = dtos.Min(d => d.Date); var dtoMinDate = dtos.Min(d => d.Date);
@ -105,7 +105,7 @@ namespace AsbCloudInfrastructure.Services
analyticsService.SaveAnalytics(dto); analyticsService.SaveAnalytics(dto);
} }
db.SaveChanges(); return await db.SaveChangesAsync(token);
} }
public async Task<DatesRangeDto> GetDataDatesRangeAsync(int idWell, public async Task<DatesRangeDto> GetDataDatesRangeAsync(int idWell,

View File

@ -31,7 +31,7 @@ namespace AsbCloudInfrastructure.Services
return dto; return dto;
} }
public async Task UpsertAsync(int idWell, int idCategory, public async Task<int> UpsertAsync(int idWell, int idCategory,
Tdto value, CancellationToken token = default) Tdto value, CancellationToken token = default)
{ {
var model = value.Adapt<TModel>(); var model = value.Adapt<TModel>();
@ -57,7 +57,7 @@ namespace AsbCloudInfrastructure.Services
db.LastData.Add(newLastData); db.LastData.Add(newLastData);
} }
db.SaveChanges(); return await db.SaveChangesAsync(token);
} }
} }