2021-09-17 16:24:01 +05:00
|
|
|
|
using AsbCloudApp.Data;
|
|
|
|
|
using AsbCloudApp.Services;
|
|
|
|
|
using AsbCloudDb.Model;
|
|
|
|
|
using AsbCloudInfrastructure.Services.Cache;
|
|
|
|
|
using Mapster;
|
|
|
|
|
|
|
|
|
|
namespace AsbCloudInfrastructure.Services
|
|
|
|
|
{
|
2021-11-22 11:30:08 +05:00
|
|
|
|
public class TelemetryDataSaubService: TelemetryDataBaseService<TelemetryDataSaubDto, TelemetryDataSaub>
|
2021-09-17 16:24:01 +05:00
|
|
|
|
{
|
|
|
|
|
public TelemetryDataSaubService(
|
|
|
|
|
IAsbCloudDbContext db,
|
|
|
|
|
ITelemetryService telemetryService,
|
|
|
|
|
CacheDb cacheDb)
|
|
|
|
|
:base(db, telemetryService, cacheDb)
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
public override TelemetryDataSaub Convert(TelemetryDataSaubDto src)
|
|
|
|
|
{
|
|
|
|
|
var entity = src.Adapt<TelemetryDataSaub>();
|
2021-09-23 10:53:48 +05:00
|
|
|
|
var telemetryUser = cacheTelemetryUsers?
|
2021-09-17 16:24:01 +05:00
|
|
|
|
.FirstOrDefault(u => u.IdTelemetry == src.IdTelemetry && (u.Name == src.User || u.Surname == src.User));
|
2021-09-23 10:53:48 +05:00
|
|
|
|
entity.IdUser = telemetryUser?.IdUser;
|
2021-09-17 16:24:01 +05:00
|
|
|
|
return entity;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override TelemetryDataSaubDto Convert(TelemetryDataSaub src)
|
|
|
|
|
{
|
|
|
|
|
var dto = src.Adapt<TelemetryDataSaubDto>();
|
2021-09-23 10:53:48 +05:00
|
|
|
|
var telemetryUser = cacheTelemetryUsers?
|
2021-09-17 16:24:01 +05:00
|
|
|
|
.FirstOrDefault(u => u.IdTelemetry == src.IdTelemetry && u.IdUser == src.IdUser);
|
2021-09-23 10:53:48 +05:00
|
|
|
|
dto.User = telemetryUser?.MakeDisplayName();
|
2021-09-17 16:24:01 +05:00
|
|
|
|
return dto;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|