I have this action method, I want to update the movie throw patching and there is not a method like ApplyTo[Async], what can I do ?
[HttpPatch("{id}/edit")]
public async Task<IActionResult> EditMoviePatchAsync([FromRoute] int id, [FromBody]
JsonPatchDocument<MoviePatchModel> patchModel)
{
if (!ModelState.IsValid)
{
return BadRequest();
}
var movie = await _ctx.Movies.FirstOrDefaultAsync(m => m.Id == id);
if (movie == null)
{
return NotFound();
}
patchModel.ApplyTo(movie, ModelState);
await _ctx.SaveChangesAsync();
return Ok();
}