Open thangchung opened 6 years ago
[HttpPatch("{id:int}")] public IActionResult PartiallyUpdate(int id, [FromBody] JsonPatchDocument<Thing> patchDoc) { if (patchDoc == null) { return BadRequest(); } Thing existingEntity = _thingsRepository.GetSingle(id); if (existingEntity == null) { return NotFound(); } Thing thing = existingEntity; patchDoc.ApplyTo(thing, ModelState); if (!ModelState.IsValid) { return BadRequest(ModelState); } Thing updatedThing = _thingsRepository.Update(id, thing); return Ok(updatedThing); }
https://github.com/damienbod/AngularWebpackVisualStudio/blob/master/src/AngularWebpackVisualStudio/Controllers/ThingsController.cs#L44
https://github.com/damienbod/AngularWebpackVisualStudio/blob/master/src/AngularWebpackVisualStudio/Controllers/ThingsController.cs#L44