forked from ddrilling/AsbCloudServer
Fix mapping entity to dto
This commit is contained in:
parent
615771395d
commit
ac21fc6776
@ -60,7 +60,8 @@ public class DetectedOperationRepository : CrudRepositoryBase<DetectedOperationD
|
||||
var query = BuildQuery(request)
|
||||
.Include(o => o.OperationCategory);
|
||||
var entities = await query.ToArrayAsync(token);
|
||||
var dtos = entities.Select(Convert);
|
||||
var offset = telemetryService.GetTimezone(request.IdTelemetry).Offset;
|
||||
var dtos = entities.Select(o => Convert(o, offset));
|
||||
|
||||
return dtos;
|
||||
}
|
||||
@ -181,13 +182,11 @@ public class DetectedOperationRepository : CrudRepositoryBase<DetectedOperationD
|
||||
return query;
|
||||
}
|
||||
|
||||
protected override DetectedOperationDto Convert(DetectedOperation src)
|
||||
protected virtual DetectedOperationDto Convert(DetectedOperation src, TimeSpan offset)
|
||||
{
|
||||
var timezone = telemetryService.GetTimezone(src.IdTelemetry);
|
||||
|
||||
var dto = src.Adapt<DetectedOperationDto>();
|
||||
dto.DateStart = src.DateStart.ToOffset(timezone.Offset);
|
||||
dto.DateEnd = src.DateEnd.ToOffset(timezone.Offset);
|
||||
dto.DateStart = src.DateStart.ToOffset(offset);
|
||||
dto.DateEnd = src.DateEnd.ToOffset(offset);
|
||||
return dto;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user