CopyProcessor: update existing layer

This commit is contained in:
Michał Zieliński
2023-10-03 22:29:42 +02:00
parent f22b1933df
commit ac7b01482e
6 changed files with 81 additions and 50 deletions

View File

@@ -252,18 +252,14 @@ namespace WebAPI.Controllers
switch (processType)
{
case "Copy":
CopyProcessor cp = new CopyProcessor(db, googleSheetValues);
processedLayer = cp.process(sourceLayer, processWorker?.Id);
CopyProcessor cp = new CopyProcessor(db, googleSheetValues, this);
cp.process(sourceLayer, processWorker?.Id);
break;
case "Deaggregation":
DeaggregationProcessor dp = new DeaggregationProcessor(db, googleSheetValues);
processedLayer = dp.process(sourceLayer, processWorker?.Id);
break;
}
if (processedLayer != null)
{
AddLayer(processedLayer, Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"));
}
}
}
}
@@ -394,7 +390,7 @@ namespace WebAPI.Controllers
});
}
private Layer AddLayer(Layer input, Guid currentUserId)
public Layer AddLayer(Layer input, Guid currentUserId)
{
input.CreatedById = currentUserId;
input.ModifiedById = currentUserId;
@@ -406,7 +402,7 @@ namespace WebAPI.Controllers
return input;
}
private void SaveRecords(Guid id, ICollection<Record> records, Guid currentUserId)
public void SaveRecords(Guid id, ICollection<Record> records, Guid currentUserId)
{
try
{
@@ -432,7 +428,7 @@ namespace WebAPI.Controllers
foreach (ProcessSource processSource in sources)
{
Console.WriteLine($"{processSource.LayerId} {processSource.SourceId}");
// db.ProcessSources.Add(processSource);
db.ProcessSources.Add(processSource);
}
}
catch (Exception)