public async Task <ActionResult <ManipulationResult <DocumentType> > > PatchDocumentTypeAsync(int id, [FromBody] JsonPatchDocument <DocumentType> documentTypePatch) { if (documentTypePatch is null) { return(BadRequest()); } var userIdClaimed = HttpContext.User.Identity.GetUserIdClaim(); if (userIdClaimed is null) { return(BadRequest()); } // create empty document .. var patchedDocumentType = new DocumentType(); // .. and apply patch on it documentTypePatch.ApplyTo(patchedDocumentType); if (!TryValidateModel(patchedDocumentType)) { return(BadRequest("Patch syntax invalid")); } var patchResult = await _documentTypeService.UpdateDocumentTypeAsync(userIdClaimed.Value, id, patchedDocumentType); if (patchResult is null) { return(BadRequest("Tried to update non updateable attributes")); } return(Ok(patchResult)); }