public async Task <IActionResult> Update([FromHeader] string authToken, string id, LabBenchUpdate benchIn) { if (!await _authenticationService.CheckAccess(authToken, "benchMgr")) { return(Unauthorized()); } LabBench bench = await _labBenchService.Get(id); if (bench == null) { return(NotFound()); } _labBenchService.Update(bench, benchIn); await _logService.Create(new Log( null, AuthenticationHelpers.GetUserIdFromToken(authToken), DateTime.UtcNow, "Document modified.", "labBenches", id, JsonSerializer.Serialize(LabBench.FromUpdate(bench, benchIn)) )); return(Ok()); }
public async void Update(LabBench original, LabBenchUpdate update) => await _labBenches.ReplaceOneAsync(labBench => labBench.Id == original.Id, LabBench.FromUpdate(original, update));