Ejemplo n.º 1
0
        public async Task <SaveAllLogicEditor> SaveAll([FromBody] SaveAllLogicEditor data)
        {
            await using var dbContextNodeInstances = new AutomaticaContext(_config);

            var nodeInstanceController = new NodeInstanceController(dbContextNodeInstances, _notifyDriver,
                                                                    _nodeInstanceCache, _coreServer);

            var pages = await Save(data.LogicPages);

            await _coreServer.ReInit();

            return(new SaveAllLogicEditor
            {
                LogicPages = pages.ToList(),
                NodeInstances = nodeInstanceController.Get().ToList()
            });
        }
Ejemplo n.º 2
0
        public async Task <SaveAllLogicEditor> SaveAll([FromBody] SaveAllLogicEditor data)
        {
            IEnumerable <NodeInstance> nodeInstancesSaved = null;

            await using (var dbContextNodeInstances = new AutomaticaContext(_config))
            {
                var nodeInstanceController = new NodeInstanceController(dbContextNodeInstances, _notifyDriver, _nodeInstanceCache, _coreServer);
                nodeInstancesSaved = await nodeInstanceController.Save(data.NodeInstances, false);
            }

            var pages = await Save(data.LogicPages);

            await _coreServer.ReInit();

            return(new SaveAllLogicEditor
            {
                LogicPages = pages.ToList(),
                NodeInstances = nodeInstancesSaved.ToList()
            });
        }