Example #1
0
        public async Task UpdateAsync()
        {
            var productNames = await _dataProdiver.GetProductsAsync();

            foreach (var productName in productNames)
            {
                try
                {
                    _logger.LogInformation($"Getting subcases for {productName}...");
                    var subcases = (await _dataProdiver.GetSubcasesAsync(productName)).ToArray();

                    _logger.LogInformation($"{subcases.Count()} subcases for {productName}...");
                    var product = new Product
                    {
                        Id         = GetHash(productName),
                        Name       = productName,
                        ReportLink = _dataProdiver.GetReportLink(productName),
                        Subcases   = subcases.ToArray()
                    };
                    await RegisterProductAsync(product);

                    _logger.LogInformation($"Update complete for {productName}");
                }
                catch (Exception error)
                {
                    _logger.LogError(error, $"Error on updating subcases for {productName}");
                }
            }
        }
Example #2
0
        public async Task <IEnumerable <string> > Products()
        {
            logger_.LogInformation("Loading products...");
            var products = await dataProdiver_.GetProductsAsync();

            return(products.OrderBy(each => each));
        }
Example #3
0
 public async Task <IEnumerable <string> > GetProductsAsync()
 {
     return(await _dataProdiver.GetProductsAsync());
 }