コード例 #1
0
        public dynamic AddExecutorImage(Guid tool_id, Guid executor_id, ExecutorImageCreateM model)
        {
            try
            {
                EnsureExecutorExisted(tool_id, executor_id);

                ExecutorImage executor_image = _executorImage.Add(new ExecutorImage
                {
                    ExecutorId = executor_id,
                    Name       = model.Name,
                    Value      = model.Value
                });
                SaveChanges();

                return(new
                {
                    executor_image.Id,
                    executor_image.Name,
                    executor_image.Value
                });
            }
            catch (Exception e)
            {
                throw e is RequestException ? e : _errorHandler.WriteLog("An error occurred!",
                                                                         e, DateTime.Now, "Server", "Service-Configuration-AddExecutorImage");
            }
        }
コード例 #2
0
 public IActionResult AddExecutorImage([FromRoute] Guid tool_id, [FromRoute] Guid executor_id, [FromBody] ExecutorImageCreateM model)
 {
     try
     {
         return(Created("", _configuration.AddExecutorImage(tool_id, executor_id, model)));
     }
     catch (Exception e)
     {
         return(GetError(e));
     }
 }