public IActionResult PlusCount(string toolName) { Tool tool = _toolService.GetByToolName(toolName); // Console.WriteLine(JsonConvert.SerializeObject(tool, Formatting.Indented)); tool.maxCount += 1; _toolService.Update(tool.id, tool); return(RedirectToAction("RoomAndTool", new { roomName = tool.room })); }
public async Task <IActionResult> Update([FromHeader] string authToken, string id, ToolGroupUpdate groupIn) { if (!await _authenticationService.CheckAccess(authToken, "stuToolMgr")) { return(Unauthorized()); } var toolGroup = await _toolService.Get(id); if (toolGroup == null) { return(NotFound()); } _toolService.Update(toolGroup, groupIn); await _logService.Create(new Log( null, AuthenticationHelpers.GetUserIdFromToken(authToken), DateTime.UtcNow, "Document modified.", "toolGroups", id, JsonSerializer.Serialize(ToolGroup.FromUpdate(toolGroup, groupIn)) )); return(Ok()); }
public IActionResult Update(string id, Tool toolIn) { var tool = _toolService.Get(id); if (tool == null) { return(NotFound()); } _toolService.Update(id, toolIn); return(NoContent()); }
public async Task <Tool> Put([FromBody] Tool tool) { return(await _toolService.Update(tool)); }