public dynamic AddResourceClass(Guid tool_id, Guid executor_id, ResourceClassCreateM model)
        {
            try
            {
                EnsureExecutorExisted(tool_id, executor_id);

                ResourceClass resource_class = _resourceClass.Add(new ResourceClass
                {
                    ExecutorId = executor_id,
                    Name       = model.Name
                });
                SaveChanges();

                return(new
                {
                    resource_class.Id,
                    resource_class.Name
                });
            }
            catch (Exception e)
            {
                throw e is RequestException ? e : _errorHandler.WriteLog("An error occurred!",
                                                                         e, DateTime.Now, "Server", "Service-Configuration-AddResourceClass");
            }
        }
예제 #2
0
 public IActionResult AddResourceClass([FromRoute] Guid tool_id, [FromRoute] Guid executor_id, [FromBody] ResourceClassCreateM model)
 {
     try
     {
         return(Created("", _configuration.AddResourceClass(tool_id, executor_id, model)));
     }
     catch (Exception e)
     {
         return(GetError(e));
     }
 }