Example #1
0
        public async Task <IActionResult> Patch([FromRoute] Guid id, [FromBody] JsonPatchDocument <UpdateWeaponCommand> jsonPatch)
        {
            var originalWeapon = await repository.GetByIdAsync(id);

            var updateWeaponCommand = mapper.Map <UpdateWeaponCommand>(originalWeapon);

            jsonPatch.ApplyTo(updateWeaponCommand);

            var response = await this.updateWeaponHandler.Handle(id, updateWeaponCommand);

            return(Ok(response));
        }