Add possibility to create Patch model
Closed this issue · 2 comments
Marusyk commented
Currently we have
[HttpPatch]
public Person Patch([FromBody] Patch<Person> personPatch)
{
var person = _repo.GetPersonById(1);
personPatch.Apply(person);
return person;
}
So, creating of Patch model is doing by Model Binder.
It would be nice to have possibility to create it manually:
[HttpPatch]
public void Patch([FromBody] Patch<Person> personPatch)
{
var personPatch = new Patch<Person>(personDto)
var person = _repo.GetPersonById(1);
personPatch.Apply(person);
return person;
}
petmat commented
Is there a typo in the second example code? You define personPatch twice but personDto is not defined.