示例#1
0
        private async Task <DataServiceResponse> PostNewEntityAsync(Uri baseAddress, MixVehicle entity, string entitySetName)
        {
            var context = WriterClient(baseAddress, ODataProtocolVersion.V4);

            context.AddObject(entitySetName, entity);

            return(await context.SaveChangesAsync());
        }
示例#2
0
        private async Task <DataServiceResponse> UpdateEntityAsync(Uri baseAddress, MixVehicle from, Func <MixVehicle, MixVehicle> update, string entitySetName)
        {
            var context = WriterClient(baseAddress, ODataProtocolVersion.V4);

            context.AttachTo(entitySetName, from);
            var to = update(from);

            context.UpdateObject(to);

            return(await context.SaveChangesAsync());
        }