forked from ddrilling/AsbCloudServer
38 lines
1.4 KiB
C#
38 lines
1.4 KiB
C#
using AsbCloudApp.Data.SAUB;
|
|
using AsbCloudApp.Services;
|
|
using AsbCloudDb.Model;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Caching.Memory;
|
|
using System;
|
|
|
|
namespace AsbCloudInfrastructure.Repository
|
|
{
|
|
public class SetpointsRequestRepository : CrudWellRelatedCacheServiceBase<SetpointsRequestDto, SetpointsRequest>
|
|
{
|
|
private readonly IWellService wellService;
|
|
|
|
public SetpointsRequestRepository(IAsbCloudDbContext dbContext, IMemoryCache memoryCache, IWellService wellService)
|
|
: base(dbContext, memoryCache, q => q.Include(s => s.Author)
|
|
.Include(s => s.Well))
|
|
{
|
|
this.wellService = wellService;
|
|
}
|
|
|
|
protected override SetpointsRequestDto Convert(SetpointsRequest src)
|
|
{
|
|
var result = base.Convert(src);
|
|
var timezoneOffsetHours = wellService.GetTimezone(src.IdWell).Hours;
|
|
result.UploadDate = src.UploadDate.ToRemoteDateTime(timezoneOffsetHours);
|
|
return result;
|
|
}
|
|
|
|
protected override SetpointsRequest Convert(SetpointsRequestDto src)
|
|
{
|
|
var result = base.Convert(src);
|
|
var timezoneOffsetHours = wellService.GetTimezone(src.IdWell).Hours;
|
|
result.UploadDate = src.UploadDate.ToUtcDateTimeOffset(timezoneOffsetHours);
|
|
return result;
|
|
}
|
|
}
|
|
}
|