DocumentClient.ReplaceOfferAsync(Offer) Method

Definition

Replaces a Offer in the Azure Cosmos DB service as an asynchronous operation.

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.Offer>> ReplaceOfferAsync (Microsoft.Azure.Documents.Offer offer);
abstract member ReplaceOfferAsync : Microsoft.Azure.Documents.Offer -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.Offer>>
override this.ReplaceOfferAsync : Microsoft.Azure.Documents.Offer -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.Offer>>

Parameters

offer
Offer

The updated Offer to replace the existing resource with.

Returns

Task<ResourceResponse<Offer>>

A System.Threading.Tasks containing a ResourceResponse<TResource> which wraps a Offer containing the updated resource record.

Implements

Exceptions

If offer is not set.

This exception can encapsulate many different types of errors. To determine the specific error always look at the StatusCode property. Some common codes you may get when creating a Document are:

StatusCodeReason for exception
404NotFound - This means the resource you tried to delete did not exist.

Examples

//Fetch the resource to be updated
Offer offer = client.CreateOfferQuery()
                         .Where(r =&gt; r.ResourceLink == "collection selfLink")    
                         .AsEnumerable()
                         .SingleOrDefault();

//Change the user mode to All
offer.OfferType = "S3";

//Now persist these changes to the database by replacing the original resource
Offer updated = await client.ReplaceOfferAsync(offer);

Applies to

See also