Ejemplo n.º 1
0
        public async Task <IActionResult> GetOneForRender(string id)
        {
            var result = await _standardRepository.GetOneForRenderAsync(id);

            _logger.Info("Found standard component: {@result}", result);
            return(Ok(result));
        }
        public async Task <IActionResult> GetOneForRender(string id)
        {
            var result = await _standardRepository.GetOneForRenderAsync(id);

            // Enhancement 0.9.0: We need to append more controls which are related to Composite Control
            if (result.Controls != null && result.Controls.Any())
            {
                var compositeControls = result.Controls.Where(a => a.Type == Entities.SectionParts.Controls.ControlType.Composite).ToList();
                foreach (var control in compositeControls)
                {
                    var compositeControl = await _compositeControlRepository.GetOneAsync(control.CompositeControlId);

                    foreach (var childControl in compositeControl.Controls)
                    {
                        childControl.HideSensitive();
                        childControl.CompositeControlId = control.Name;
                        childControl.Name = control.Name + "_" + childControl.Name;
                    }
                    result.Controls.AddRange(compositeControl.Controls);
                }
            }

            _logger.Info("Found standard component: {@result}", result);
            return(Ok(result));
        }