public async Task <IActionResult> Patch(string key, [FromBody] JsonPatchDocument <Auction> auctionPatch) { var cosmosCollection = new CosmosCollection <Auction>("AuctionsCollection"); var auction = (await cosmosCollection.GetItemsAsync(item => item.Id == key)).FirstOrDefault(); if (auction == null) { return(NotFound()); } auctionPatch.ApplyTo(auction); await cosmosCollection.UpdateItemAsync(key, auction); return(Accepted(auction)); }
public async Task <IActionResult> Put([FromODataUri] string key, [FromBody] Auction auctionUpdate) { var cosmosCollection = new CosmosCollection <Auction>("AuctionsCollection"); var auction = (await cosmosCollection.GetItemsAsync(item => item.Id == key)).FirstOrDefault(); if (auction == null) { return(NotFound()); } if (auction.TimeStamp != auctionUpdate.TimeStamp) { return(Conflict()); } await cosmosCollection.UpdateItemAsync(key, auctionUpdate); return(Accepted(auction)); }