public IActionResult PatchWorkTime(int userId, int workTimeId, [FromBody] JsonPatchDocument <WorkTimeForPartialUpdateDTO> patchDocument) { if (_repo.GetUser(userId) == null) { return(NotFound()); } var workTimeToUpdate = _repo.GetWorkTime(userId, workTimeId); if (workTimeToUpdate == null) { return(NotFound()); } var workTimeWithUpdatedValues = ModelsMapping.GetWorkTimeForPartialUpdateDto(workTimeToUpdate); patchDocument.ApplyTo(workTimeWithUpdatedValues); if (!ModelState.IsValid) { return(BadRequest()); } ValuesUpdater.ApplyPatchToWorkTimeEntity(workTimeToUpdate, workTimeWithUpdatedValues); _repo.SaveChanges(); return(Ok()); }