public IActionResult UpdateOffice(int officeId, [FromBody] JsonPatchDocument <BranchOfficeForUpdateDTO> patchDocument) { if (patchDocument == null) { return(BadRequest()); } if (!_branchOfficeService.OfficeExists(officeId)) { return(NotFound()); } var officeToUpdate = this._branchOfficeService.GetForUpdateById(officeId); patchDocument.ApplyTo(officeToUpdate, ModelState); if (_branchOfficeService.Update(officeId, officeToUpdate) >= 0) { return(Ok()); } else { return(StatusCode(500, "Error trying to update office")); } }