public async Task ViewAWidget(StockCode stockCode) { // ... var widget = await _widgetQueries.Get(stockCode); // ... }
public async Task <Widget> Get(StockCode stockCode) { var operation = TableOperation.Retrieve <WidgetEntity>(stockCode.Category.ToLowerInvariant(), stockCode.Id.ToLowerInvariant()); TableResult result = await _cloudTable.ExecuteAsync(operation); var entity = result.Result as WidgetEntity; return(new Widget { StockCode = new StockCode { Category = entity.PartitionKey, Id = entity.RowKey }, Description = entity.Description }); }