public dynamic AddStep(Guid tool_id, Guid executor_id, StepCreateM model)
        {
            try
            {
                EnsureExecutorExisted(tool_id, executor_id);

                Step step = _step.Add(new Step
                {
                    ExecutorId   = executor_id,
                    ReplacedText = model.ReplacedText,
                    Stage        = model.Stage,
                    Name         = model.Name,
                    Text         = model.Text
                });
                SaveChanges();

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