May 2019
Intermediate to advanced
504 pages
11h 50m
English
Considering the auctions dataset, since we have created our MVC application, we should include two GET methods in our controller, one for retrieving the complete collection of auctions, and one that will retrieve a specific auction.
Let's see how we can do this:
[HttpGet]public async Task<IEnumerable<Auction>> Get(){ var result = Enumerable.Empty<Auction>(); try { result = await _cosmosCollection.GetItemsAsync(item => true); } catch (Exception ex) { // Log the error or throw depending on the requirements } return result;}
Notice that the predicate we are using here is targeting the complete set of auctions. We can expand ...
Read now
Unlock full access