Пример #1
0
 public async Task <Tool> Post([FromBody] Tool tool)
 {
     try
     {
         return(await _toolService.Create(tool));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     return(tool);
 }
        public async Task <ActionResult <ToolGroup> > Create([FromHeader] string authToken, ToolGroupCreate tool)
        {
            if (!await _authenticationService.CheckAccess(authToken, "stuToolMgr"))
            {
                return(Unauthorized());
            }

            ToolGroup created = await _toolService.Create(tool);

            await _logService.Create(new Log(
                                         null,
                                         AuthenticationHelpers.GetUserIdFromToken(authToken),
                                         DateTime.UtcNow,
                                         "Document created.",
                                         "toolGroups",
                                         created.Id,
                                         JsonSerializer.Serialize(created)
                                         ));

            return(Ok(tool));
        }
Пример #3
0
        public ActionResult <Tool> Create(Tool tool)
        {
            _toolService.Create(tool);

            return(CreatedAtRoute("GetTool", new { id = tool.id.ToString() }, tool));
        }