Merge branch 'feature/#30435481-unification-date/time' into feature/refactoring_well_operation

# Conflicts:
#	AsbCloudInfrastructure/Repository/WellOperationRepository.cs
This commit is contained in:
Степанов Дмитрий 2024-03-29 07:34:50 +03:00
commit 0fb65c7e83
4 changed files with 7 additions and 5 deletions

View File

@ -112,7 +112,7 @@ namespace AsbCloudInfrastructure.Repository
private static TEntity Convert(Tdto dto)
{
var entity = dto.Adapt<TEntity>();
entity.UpdateDate = DateTimeOffset.Now;
entity.UpdateDate = DateTimeOffset.UtcNow;
return entity;
}
}

View File

@ -68,8 +68,6 @@ namespace AsbCloudInfrastructure.Services.SAUB
query = query.OrderByDescending(m => m.DateTime);
var timezone = telemetryService.GetTimezone(telemetry.Id);
if (request.Begin is not null)
{
var beginUtc = request.Begin.Value.ToUniversalTime();
@ -102,6 +100,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
var usersDict = users.ToDictionary(x => x.IdUser, x => x);
var messagesDtoList = new List<MessageDto>();
var timezone = telemetryService.GetTimezone(telemetry.Id);
foreach (var message in messagesList)
{

View File

@ -41,7 +41,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
public async Task<int> InsertAsync(SetpointsRequestDto setpointsRequest, CancellationToken token)
{
setpointsRequest.IdState = 1;
setpointsRequest.UploadDate = DateTime.UtcNow;
setpointsRequest.UploadDate = DateTimeOffset.UtcNow;
var result = await setpointsRepository.InsertAsync(setpointsRequest, token);
return result;
}

View File

@ -22,7 +22,10 @@ namespace AsbCloudWebApi.Converters
{
if (value is string str)
{
return DateOnly.Parse(str);
if (DateTimeOffset.TryParse(str, out DateTimeOffset dateTime))
return DateOnly.FromDateTime(dateTime.Date);
if (DateTime.TryParse(str, out DateTime date))
return DateOnly.FromDateTime(date);
}
return base.ConvertFrom(context, culture, value);
}