DD.WellWorkover.Cloud/AsbCloudInfrastructure/Repository/DrillTestRepository.cs

29 lines
777 B
C#

using AsbCloudApp.Data.SAUB;
using AsbCloudApp.Repositories;
using AsbCloudDb.Model;
using Mapster;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudInfrastructure.Repository
{
public class DrillTestRepository : IDrillTestRepository
{
private readonly IAsbCloudDbContext db;
public DrillTestRepository(IAsbCloudDbContext db)
{
this.db = db;
}
public async Task<int> SaveDataAsync(int idTelemetry, DrillTestDto dto, CancellationToken token)
{
var entity = dto.Adapt<DrillTest>();
entity.IdTelemetry = idTelemetry;
db.DrillTests.Add(entity);
var result = await db.SaveChangesAsync(token);
return result;
}
}
}