public async Task <IActionResult> Update([FromHeader] string authToken, string id, string techId) { if (!await _authenticationService.CheckAccess(authToken, "groupMgr")) { return(Unauthorized()); } User checkOut = await _userService.GetByTechId(techId); LabGroup group = await _labGroupService.GetByMemberId(checkOut.Id); if (group == null) { return(NotFound()); } _labGroupService.CheckOut(group, id); await _logService.Create(new Log( null, AuthenticationHelpers.GetUserIdFromToken(authToken), DateTime.UtcNow, "Document modified.", "labGroups", id, JsonSerializer.Serialize(LabGroup.FromCheckOut(group, id)) )); return(Ok()); }
public async void CheckOut(LabGroup original, string checkOut) => await _labGroups.ReplaceOneAsync(labGroup => labGroup.Id == original.Id, LabGroup.FromCheckOut(original, checkOut));