Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public ActionResult<PersonReadModel> UpdatePerson(int id, [FromBody] PersonWrite
[HttpPatch("{id:int}")]
public ActionResult<PersonReadModel> PatchPerson(
int id,
// PTrampert.SimplePatch automatically generates an implementation of IPatchObjectFor<PersonWriteModel>
// PTrampert.SimplePatch automatically generates an implementation of IPatchObject<PersonWriteModel>
[FromBody] IPatchObject<PersonWriteModel> patchObject)
{
// Validation is preserved on the patch object, so we can check ModelState
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ public record PersonWriteModel
public PhoneNumber? PhoneNumber { get; init; }
}
```
* Use `IPatchObjectFor<PersonWriteModel>` to create an optional object for PATCH operations:
* Use `IPatchObject<PersonWriteModel>` to create an optional object for PATCH operations:

```csharp
[HttpPatch("{id:int}")]
public ActionResult<PersonReadModel> PatchPerson(
int id,
// PTrampert.SimplePatch automatically generates an implementation of IPatchObjectFor<PersonWriteModel>
[FromBody] IPatchObjectFor<PersonWriteModel> patchObject)
// PTrampert.SimplePatch automatically generates an implementation of IPatchObject<PersonWriteModel>
[FromBody] IPatchObject<PersonWriteModel> patchObject)
{
// Validation is preserved on the patch object, so we can check ModelState
if (!ModelState.IsValid)
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ dotnet add package PTrampert.SimplePatch
if (person == null) return NotFound();

// Apply the patch and get the updated model
var updatedPerson = patch.ApplyTo(person);
var updatedPerson = patch.Patch(person);
db.People.Update(updatedPerson);
db.SaveChanges();
return Ok(updatedPerson);
Expand Down
Loading