Exemplo n.º 1
0
        public async Task <IActionResult> Install(ModuleInstallModel model)
        {
            var command       = new ModuleInstallCommand(model.Id.Module, model.ConcurrencyToken, model.Id.Version);
            var commandResult = await _messageDispatcher.DispatchAsync(command);

            if (commandResult.IsSuccess)
            {
                return(RedirectToAction(nameof(Details), new { id = model.Id }));
            }

            return(GetActionResult(commandResult, model));
        }
        public IActionResult ModuleFound()
        {
            ModuleDefinitionInfo         moduleDefinition   = null;
            ModuleInstallModel           moduleModel        = null;
            List <ModuleInstallModel>    model              = new List <ModuleInstallModel>();
            IList <ModuleDefinitionInfo> modulesDefinitions = _viewManager.GetModuleDefsList();

            foreach (Assembly assembly in KastraAssembliesContext.Instance.GetModuleAssemblies())
            {
                moduleDefinition = modulesDefinitions.SingleOrDefault(m => IsInFolder(assembly.Location, m.Path));

                moduleModel = new ModuleInstallModel();
                moduleModel.AssemblyName       = assembly.GetName().Name;
                moduleModel.Version            = assembly.GetCustomAttribute <AssemblyFileVersionAttribute>().Version;
                moduleModel.ModuleDefinitionId = moduleDefinition?.ModuleDefId ?? 0;
                moduleModel.Name = moduleDefinition?.Name ?? String.Empty;

                model.Add(moduleModel);
            }

            return(Ok(model));
        }