private async Task SetProductsCache() { if (!_objectCache.Contains(_productCacheKey)) { _objectCache.SetItem(_productCacheKey, await _eatClient.GetProductsAsync()); } }
public async Task <ProductsResult> GetProducts() { ProductsResult result = new ProductsResult(); try { GetProductsResult output = await _eatClient.GetProductsAsync(); if (output.ResultCode == -1) { throw new Exception(); } result.Products = output.Products?.Select(p => new Classes.Products { ProductGuid = p.ProductGuid, Name = p.Name }).ToList() ?? new List <Classes.Products>(); } catch (Exception ex) { SetException(result, ex); } return(result); }