コード例 #1
0
        private async Task <DataServiceResponse> PostNewEntityAsync(Uri address, string entitySetName, CollectionProperty_Entity entity)
        {
            var context = WriterClient(address, ODataProtocolVersion.V4);

            context.AddObject(entitySetName, entity);
            return(await context.SaveChangesAsync());
        }
コード例 #2
0
        private async Task <DataServiceResponse> UpdateEntityAsync(Uri address, string entitySetName, CollectionProperty_Entity entity, Action <CollectionProperty_Entity> update)
        {
            var context = WriterClient(address, ODataProtocolVersion.V4);

            context.AttachTo(entitySetName, entity);
            update(entity);
            context.UpdateObject(entity);

            return(await context.SaveChangesAsync());
        }