import => support instanceId + Delete resource, delete imageId and ref for configuration
This commit is contained in:
parent
499065bdb7
commit
390852ce4f
@ -422,6 +422,7 @@ namespace ManagerService.Controllers
|
|||||||
|
|
||||||
configuration = new Configuration();
|
configuration = new Configuration();
|
||||||
configuration.Id = exportConfiguration.id;
|
configuration.Id = exportConfiguration.id;
|
||||||
|
configuration.InstanceId = exportConfiguration.instanceId;
|
||||||
configuration.Label = exportConfiguration.label;
|
configuration.Label = exportConfiguration.label;
|
||||||
configuration.Title = exportConfiguration.title;
|
configuration.Title = exportConfiguration.title;
|
||||||
configuration.ImageId = exportConfiguration.imageId;
|
configuration.ImageId = exportConfiguration.imageId;
|
||||||
@ -446,6 +447,7 @@ namespace ManagerService.Controllers
|
|||||||
{
|
{
|
||||||
Section newSection = new Section();
|
Section newSection = new Section();
|
||||||
newSection.Id = section.id;
|
newSection.Id = section.id;
|
||||||
|
newSection.InstanceId = section.instanceId;
|
||||||
newSection.Label = section.label;
|
newSection.Label = section.label;
|
||||||
newSection.Title = section.title;
|
newSection.Title = section.title;
|
||||||
newSection.Description = section.description;
|
newSection.Description = section.description;
|
||||||
@ -580,6 +582,7 @@ namespace ManagerService.Controllers
|
|||||||
{
|
{
|
||||||
Resource resource = new Resource();
|
Resource resource = new Resource();
|
||||||
resource.Id = resourceExport.id;
|
resource.Id = resourceExport.id;
|
||||||
|
resource.InstanceId = resourceExport.instanceId;
|
||||||
resource.Type = resourceExport.type;
|
resource.Type = resourceExport.type;
|
||||||
resource.Label = resourceExport.label;
|
resource.Label = resourceExport.label;
|
||||||
resource.DateCreation = resourceExport.dateCreation;
|
resource.DateCreation = resourceExport.dateCreation;
|
||||||
|
|||||||
@ -27,13 +27,15 @@ namespace ManagerService.Controllers
|
|||||||
{
|
{
|
||||||
private ResourceDatabaseService _resourceService;
|
private ResourceDatabaseService _resourceService;
|
||||||
private SectionDatabaseService _sectionService;
|
private SectionDatabaseService _sectionService;
|
||||||
|
private ConfigurationDatabaseService _configurationService;
|
||||||
private readonly ILogger<ResourceController> _logger;
|
private readonly ILogger<ResourceController> _logger;
|
||||||
|
|
||||||
public ResourceController(ILogger<ResourceController> logger, ResourceDatabaseService resourceService, SectionDatabaseService sectionService)
|
public ResourceController(ILogger<ResourceController> logger, ResourceDatabaseService resourceService, SectionDatabaseService sectionService, ConfigurationDatabaseService configurationService)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_resourceService = resourceService;
|
_resourceService = resourceService;
|
||||||
_sectionService = sectionService;
|
_sectionService = sectionService;
|
||||||
|
_configurationService = configurationService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -297,6 +299,16 @@ namespace ManagerService.Controllers
|
|||||||
throw new KeyNotFoundException("Resource does not exist");
|
throw new KeyNotFoundException("Resource does not exist");
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var configuration in _configurationService.GetAll(ressource.InstanceId))
|
||||||
|
{
|
||||||
|
if (configuration.ImageId == id)
|
||||||
|
{
|
||||||
|
configuration.ImageId = null;
|
||||||
|
configuration.ImageSource = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Delete all resource occurence
|
// Delete all resource occurence
|
||||||
foreach (var section in _sectionService.GetAll(ressource.InstanceId))
|
foreach (var section in _sectionService.GetAll(ressource.InstanceId))
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user