Esempio n. 1
0
        public Guid Create(string entitySetName, CdsEntity record)
        {
            var response = _client.PostAsync($"{entitySetName}", new StringContent(record.ToJson(),
                                                                                   Encoding.UTF8, "application/json"));

            HandleError(response);

            var value = response.Result.Headers.GetValues("OData-EntityId").First();

            return(Guid.Parse(Regex.Matches(value, $"{response.Result.RequestMessage.RequestUri.AbsoluteUri}\\(([^\\)]+)").First().Groups.Last().Value));
        }
Esempio n. 2
0
        public void Update(string entitySetName, CdsEntity record)
        {
            var response = _client.PatchAsync($"{entitySetName}({record.Id})", new StringContent(record.ToJson(),
                                                                                                 Encoding.UTF8, "application/json"));

            HandleError(response);
        }