forked from ddrilling/AsbCloudServer
45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
using AsbCloudApp.Repositories;
|
|
using AsbCloudDb.Model;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace AsbCloudInfrastructure.Repository
|
|
{
|
|
#nullable enable
|
|
public class TrajectoryVisualizationRepository : ITrajectoryVisualizationRepository
|
|
{
|
|
private readonly IAsbCloudDbContext context;
|
|
|
|
public TrajectoryVisualizationRepository(IAsbCloudDbContext context)
|
|
{
|
|
this.context = context;
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public async Task<IEnumerable<TrajectoryVisualizationDataDto>> GetAllAsync(int idWell, CancellationToken token)
|
|
{
|
|
var dtos = await context.PlannedTrajectories
|
|
.Where(t => t.IdWell == idWell)
|
|
.OrderBy(x => x.UpdateDate)
|
|
.Select(x => Convert(x))
|
|
.ToListAsync(token)
|
|
.ConfigureAwait(false);
|
|
|
|
return dtos;
|
|
}
|
|
|
|
private static TrajectoryVisualizationDataDto Convert(PlannedTrajectory dto)
|
|
{
|
|
return new TrajectoryVisualizationDataDto {
|
|
WellboreDepth = dto.WellboreDepth,
|
|
Azimuth = dto.AzimuthGeo,
|
|
Zenith = dto.ZenithAngle
|
|
};
|
|
}
|
|
}
|
|
#nullable disable
|
|
}
|