public static List <Product> ToProductList(List <ProductEntity> peList) { List <Product> pList = new List <Product>(); foreach (ProductEntity pe in peList) { pList.Add(ProductMappings.ToProduct(pe)); } return(pList); }
public static async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequest req, [Table("Product")] CloudTable prodTable, ILogger log) { log.LogInformation("Getting products .... "); var query = new TableQuery <ProductEntity>(); var entities = new List <ProductEntity>(); TableContinuationToken token = null; do { TableQuerySegment <ProductEntity> segment = await prodTable.ExecuteQuerySegmentedAsync(query, token); token = segment.ContinuationToken; entities.AddRange(segment); } while (token != null && (query.TakeCount == null || entities.Count < query.TakeCount.Value)); return(new OkObjectResult(ProductMappings.ToProductList(entities))); }