예제 #1
0
        public IActionResult GetByName(string command)
        {
            IOCDCommand plugin = _pluginService.GetPlugin(command);

            if (plugin == null)
            {
                return(NotFound());
            }

            CommandViewModel model = new CommandViewModel();

            model.Name        = plugin.Name;
            model.CommandName = plugin.CommandName;
            model.HelpText    = plugin.HelpText;

            return(Ok(model));
        }
예제 #2
0
        public async Task <IActionResult> Post(string command, [FromBody] string[] commandBody)
        {
            try
            {
                IOCDCommand plugin = _pluginService.GetPlugin(command);
                if (plugin == null)
                {
                    return(NotFound());
                }

                await plugin.Execute(commandBody);
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }

            return(Ok());
        }