forked from ddrilling/AsbCloudServer
refact model DB and migrations
This commit is contained in:
parent
2115a2b2c1
commit
e84d45693c
@ -72,4 +72,5 @@ namespace AsbCloudDb.Model
|
||||
[ForeignKey(nameof(IdUser))]
|
||||
public virtual User User { get; set; } = null!;
|
||||
}
|
||||
#nullable disable
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ namespace AsbCloudInfrastructure.Services.PlannedTrajectory
|
||||
{
|
||||
var entity = o.Adapt<AsbCloudDb.Model.PlannedTrajectory>();
|
||||
entity.IdWell = idWell;
|
||||
entity.LoadDate = DateTime.Today.ToUtcDateTimeOffset(timezone.Hours);
|
||||
entity.UpdateDate = DateTime.Today.ToUtcDateTimeOffset(timezone.Hours);
|
||||
entity.IdUser = idUser;
|
||||
return entity;
|
||||
});
|
||||
|
@ -30,7 +30,7 @@ namespace AsbCloudInfrastructure.Services.PlannedTrajectory
|
||||
var entity = dto.Adapt<AsbCloudDb.Model.PlannedTrajectory>();
|
||||
entity.IdWell = idWell;
|
||||
entity.Id = default;
|
||||
entity.LoadDate = DateTime.Today.ToUtcDateTimeOffset(timezone.Hours);
|
||||
entity.UpdateDate = DateTime.Today.ToUtcDateTimeOffset(timezone.Hours);
|
||||
entity.IdUser = idUser;
|
||||
db.PlannedTrajectorys.Add(entity);
|
||||
}
|
||||
@ -54,7 +54,7 @@ namespace AsbCloudInfrastructure.Services.PlannedTrajectory
|
||||
var query = db.PlannedTrajectorys
|
||||
.Where(x => x.IdWell == idWell);
|
||||
var entities = await query
|
||||
.OrderBy(e => e.LoadDate)
|
||||
.OrderBy(e => e.UpdateDate)
|
||||
.ToListAsync(token);
|
||||
var result = entities
|
||||
.Select(r => Convert(r));
|
||||
@ -67,7 +67,7 @@ namespace AsbCloudInfrastructure.Services.PlannedTrajectory
|
||||
var entity = row.Adapt<AsbCloudDb.Model.PlannedTrajectory>();
|
||||
entity.IdWell = idWell;
|
||||
entity.Id = idUser;
|
||||
entity.LoadDate = DateTime.Today.ToUtcDateTimeOffset(timezone.Hours);
|
||||
entity.UpdateDate = DateTime.Today.ToUtcDateTimeOffset(timezone.Hours);
|
||||
entity.IdUser = idUser;
|
||||
db.PlannedTrajectorys.Update(entity);
|
||||
return await db.SaveChangesAsync(token)
|
||||
|
Loading…
Reference in New Issue
Block a user