Exemplo n.º 1
0
        public IActionResult CreateCommandTemplate(CreateCommandTemplateModel model)
        {
            try
            {
                _logger.LogDebug($"Endpoint: \"Management\" Method: \"CreateCommandTemplate\"");
                ValidationResult validationResult = new ManagementValidator(model).Validate();
                if (!validationResult.IsValid)
                {
                    ExceptionHandler.ThrowProperExternalException(new InputValidationException(validationResult.Message));
                }

                return(Ok(_service.CreateCommandTemplate(model.GenericCommandTemplateId, model.Name, model.Description, model.Code,
                                                         model.ExecutableFile, model.PreparationScript, model.SessionCode)));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }