public async Task <(Tool, string)> AssociateWithoutPosition(int thingId, int toolId) { var tool = await _toolService.getTool(toolId); string result; (tool, result) = await AssociateTool(thingId, toolId); if (tool == null) { return(null, result); } tool = await _stateManagementService.setToolToStatusById(toolId, stateEnum.in_use, null); tool = await _toolService.setToolToThing(tool, thingId); tool = await _toolService.getTool(tool.toolId); Trigger(tool); return(tool, result); }
public async Task <IActionResult> UpdateById([FromBody] Justification justification, [FromQuery] int toolid, [FromQuery] string state, [FromQuery] string username) { stateEnum newState = stateEnum.available; if (!Enum.TryParse(state, out newState)) { return(BadRequest("State Not Found")); } var tools = await _stateManagementService.setToolToStatusById(toolid, newState, justification, username); if (tools == null) { return(BadRequest("State Change not Allowed By Configuration")); } return(Ok(tools)); }