public IActionResult PatchUser(int userId, [FromBody] JsonPatchDocument <UserForPartialUpdateDTO> patchDocument) { var userToUpdate = _repo.GetUser(userId); if (userToUpdate == null) { return(BadRequest()); } var userWithUpdatedValues = ModelsMapping.GetUserForPartialUpdateDto(userToUpdate); patchDocument.ApplyTo(userWithUpdatedValues); if (!ModelState.IsValid) { return(BadRequest()); } ValuesUpdater.ApplyPatchToUserEntity(userToUpdate, userWithUpdatedValues); _repo.SaveChanges(); return(Ok()); }