|
|
|
@ -78,6 +78,9 @@ namespace Expedience.Api.Consumers
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Insert this territory if it does not exist
|
|
|
|
// Insert this territory if it does not exist
|
|
|
|
|
|
|
|
_logger.LogInformation("Checking if territory {territoryId} - {contentName} exists",
|
|
|
|
|
|
|
|
completionResult.TerritoryId, message.DutyInfo.ContentName);
|
|
|
|
|
|
|
|
|
|
|
|
var territory = dbContext.Territories.FirstOrDefault(t => t.TerritoryId == completionResult.TerritoryId);
|
|
|
|
var territory = dbContext.Territories.FirstOrDefault(t => t.TerritoryId == completionResult.TerritoryId);
|
|
|
|
if (territory == null)
|
|
|
|
if (territory == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -92,14 +95,17 @@ namespace Expedience.Api.Consumers
|
|
|
|
Level = 0,
|
|
|
|
Level = 0,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (String.IsNullOrWhiteSpace(territory.ContentName))
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_logger.LogInformation("Updating territory {territoryId} with content name {contentName} and place name {placeName}",
|
|
|
|
_logger.LogInformation("Territory with Id {territoryId} with name {contentName}", territory.TerritoryId, territory.ContentName);
|
|
|
|
completionResult.TerritoryId, message.DutyInfo.ContentName, message.DutyInfo.PlaceName);
|
|
|
|
if (String.IsNullOrWhiteSpace(territory.ContentName))
|
|
|
|
|
|
|
|
{
|
|
|
|
// Update the place/content name if necessary
|
|
|
|
_logger.LogInformation("Updating territory {territoryId} with content name {contentName} and place name {placeName}",
|
|
|
|
territory.ContentName = message.DutyInfo.ContentName;
|
|
|
|
completionResult.TerritoryId, message.DutyInfo.ContentName, message.DutyInfo.PlaceName);
|
|
|
|
territory.PlaceName = message.DutyInfo.PlaceName;
|
|
|
|
// Update the place/content name if necessary
|
|
|
|
|
|
|
|
territory.ContentName = message.DutyInfo.ContentName;
|
|
|
|
|
|
|
|
territory.PlaceName = message.DutyInfo.PlaceName;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
await dbContext.SaveChangesAsync();
|
|
|
|
await dbContext.SaveChangesAsync();
|
|
|
|
|