DD.WellWorkover.Cloud/AsbCloudInfrastructure/Services/SAUB/TelemetryDataSpinService.cs
2022-11-15 17:46:58 +05:00

36 lines
1.2 KiB
C#

using AsbCloudApp.Data.SAUB;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
using AsbCloudInfrastructure.Services.Cache;
using Mapster;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudInfrastructure.Services.SAUB
{
public class TelemetryDataSpinService : TelemetryDataBaseService<TelemetryDataSpinDto, TelemetryDataSpin>
{
public TelemetryDataSpinService(
IAsbCloudDbContext db,
ITelemetryService telemetryService,
TelemetryDataCache<TelemetryDataSpinDto> telemetryDataCache,
CacheDb cacheDb)
: base(db, telemetryService, telemetryDataCache, cacheDb)
{ }
public override TelemetryDataSpin Convert(TelemetryDataSpinDto src, double timezoneOffset)
{
var entity = src.Adapt<TelemetryDataSpin>();
entity.DateTime = src.DateTime.ToUtcDateTimeOffset(timezoneOffset);
return entity;
}
public override TelemetryDataSpinDto Convert(TelemetryDataSpin src, double timezoneOffset)
{
var dto = src.Adapt<TelemetryDataSpinDto>();
dto.DateTime = src.DateTime.ToRemoteDateTime(timezoneOffset);
return dto;
}
}
}