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,
CancellationToken token = default);
Task UpdateDataAsync(string uid, IEnumerable<DataSaubBaseDto> dtos,
Task<int> UpdateDataAsync(string uid, IEnumerable<DataSaubBaseDto> dtos,
CancellationToken token);
Task<DatesRangeDto> GetDataDatesRangeAsync(int idWell,
CancellationToken token);

View File

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

View File

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

View File

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