forked from ddrilling/AsbCloudServer
37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
|
using AsbCloudApp.Data.SAUB;
|
|||
|
using AsbCloudApp.Services;
|
|||
|
using AsbCloudDb.Model;
|
|||
|
using Microsoft.EntityFrameworkCore;
|
|||
|
using System;
|
|||
|
|
|||
|
namespace AsbCloudInfrastructure.Repository
|
|||
|
{
|
|||
|
public class SetpointsRequestRepository : CrudWellRelatedCacheServiceBase<SetpointsRequestDto, SetpointsRequest>
|
|||
|
{
|
|||
|
private readonly IWellService wellService;
|
|||
|
|
|||
|
public SetpointsRequestRepository(IAsbCloudDbContext dbContext, IWellService wellService)
|
|||
|
: base(dbContext, 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;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|