a7DocumentDbStudio.Model.DocumentModel.ChangePropertyValue C# (CSharp) Method

ChangePropertyValue() public method

public ChangePropertyValue ( string propertyPath, object newValue ) : System.Threading.Tasks.Task
propertyPath string
newValue object
return System.Threading.Tasks.Task
        public async Task ChangePropertyValue(string propertyPath, object newValue)
        {
            var js = this.Json;
            var token = js.SelectToken(propertyPath);
            if (token != null)
            {
                token.Replace(JToken.FromObject(newValue));
                var replaced = await _client.ReplaceDocumentAsync(_document.SelfLink, js);
                this._document = replaced.Resource;
                this._json = null;
            }
            else
            {
                throw new Exception($"'{propertyPath}' not found...");
            }
        }