forked from ddrilling/AsbCloudServer
ChangeLogRepositoryAbstract nit
This commit is contained in:
parent
9d6fa75a01
commit
b121310819
@ -80,31 +80,31 @@ public abstract class ChangeLogRepositoryAbstract<TDto, TEntity, TRequest> : ICh
|
||||
}
|
||||
|
||||
using var transaction = db.Database.BeginTransaction();
|
||||
foreach (var entity in entitiesToDelete)
|
||||
{
|
||||
entity.IdState = ChangeLogAbstract.IdStateReplaced;
|
||||
entity.Obsolete = updateTime;
|
||||
entity.IdEditor = idUser;
|
||||
}
|
||||
result += await db.SaveChangesAsync(token);
|
||||
|
||||
var entitiesNew = dtos.Select(Convert);
|
||||
foreach (var entity in entitiesNew)
|
||||
{
|
||||
entity.IdPrevious = entity.Id;
|
||||
entity.Id = default;
|
||||
entity.Creation = updateTime;
|
||||
entity.IdAuthor = idUser;
|
||||
entity.Obsolete = null;
|
||||
entity.IdEditor = null;
|
||||
entity.IdState = ChangeLogAbstract.IdStateActual;
|
||||
dbSet.Add(entity);
|
||||
}
|
||||
|
||||
result += await SaveChangesWithExceptionHandling(token);
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var entity in entitiesToDelete)
|
||||
{
|
||||
entity.IdState = ChangeLogAbstract.IdStateReplaced;
|
||||
entity.Obsolete = updateTime;
|
||||
entity.IdEditor = idUser;
|
||||
}
|
||||
result += await db.SaveChangesAsync(token);
|
||||
|
||||
var entitiesNew = dtos.Select(Convert);
|
||||
foreach (var entity in entitiesNew)
|
||||
{
|
||||
entity.IdPrevious = entity.Id;
|
||||
entity.Id = default;
|
||||
entity.Creation = updateTime;
|
||||
entity.IdAuthor = idUser;
|
||||
entity.Obsolete = null;
|
||||
entity.IdEditor = null;
|
||||
entity.IdState = ChangeLogAbstract.IdStateActual;
|
||||
dbSet.Add(entity);
|
||||
}
|
||||
|
||||
result += await SaveChangesWithExceptionHandling(token);
|
||||
|
||||
await transaction.CommitAsync(token);
|
||||
return result;
|
||||
}
|
||||
@ -153,10 +153,11 @@ public abstract class ChangeLogRepositoryAbstract<TDto, TEntity, TRequest> : ICh
|
||||
{
|
||||
var result = 0;
|
||||
using var transaction = await db.Database.BeginTransactionAsync(token);
|
||||
result += await Clear(idUser, request, token);
|
||||
result += await InsertRange(idUser, dtos, token);
|
||||
try
|
||||
{
|
||||
result += await Clear(idUser, request, token);
|
||||
result += await InsertRange(idUser, dtos, token);
|
||||
|
||||
await transaction.CommitAsync(token);
|
||||
return result;
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ public abstract class ProcessMapPlanParser<TDto> : ParserExcelService<TDto>
|
||||
protected static int? GetIdMode(string? modeName) =>
|
||||
modeName?.Trim().ToLower() switch
|
||||
{
|
||||
"ручной" => 0,
|
||||
"ротор" => 1,
|
||||
"слайд" => 2,
|
||||
_ => null
|
||||
|
Loading…
Reference in New Issue
Block a user