public ActionResult PartialPostUpdate(int id, JsonPatchDocument <PostUpdateDto> patchDocument) { var postModelFromRepo = _repository.GetPostById(id); if (postModelFromRepo == null) { return(NotFound()); } var postToPatch = _mapper.Map <PostUpdateDto>(postModelFromRepo); patchDocument.ApplyTo(postToPatch, ModelState); if (!TryValidateModel(postToPatch)) { return(ValidationProblem(ModelState)); } _mapper.Map(postToPatch, postModelFromRepo); _repository.UpdatePost(postModelFromRepo); _repository.SaveChanges(); return(NoContent()); }