public dynamic AddExecutor(Guid tool_id, ExecutorCreateM model)
        {
            try
            {
                EnsureToolExisted(tool_id);

                Executor executor = _executor.Add(new Executor
                {
                    Language = model.Language,
                    ToolId   = tool_id,
                    Name     = model.Name
                });
                SaveChanges();

                return(new
                {
                    executor.Id,
                    executor.Name,
                    executor.Language
                });
            }
            catch (Exception e)
            {
                throw e is RequestException ? e : _errorHandler.WriteLog("An error occurred!",
                                                                         e, DateTime.Now, "Server", "Service-Configuration-AddExecutor");
            }
        }
Exemplo n.º 2
0
 public IActionResult AddExecutor([FromRoute] Guid tool_id, [FromBody] ExecutorCreateM model)
 {
     try
     {
         return(Created("", _configuration.AddExecutor(tool_id, model)));
     }
     catch (Exception e)
     {
         return(GetError(e));
     }
 }