Esempio n. 1
0
        public async Task <IActionResult> Product()
        {
            var cmd = new CreateProductCommand();

            cmd.ProductUnits = await _productUnitQuery.GetProductUnits();

            return(View(cmd));
        }
        public async Task <List <SelectListItem> > GetProductUnits()
        {
            // Check cache
            var value = cache.Get <List <SelectListItem> >("myModelCacheKey");

            if (value == null)
            {
                // Not found, get from DB
                value = await productService.GetProductUnits();

                // write it to the cache
                cache.Set("myModelCacheKey", value, cacheOptions);
            }

            return(value);
        }