public async Task <ActionResult> Edit(Product product)
        {
            if (ModelState.IsValid)
            {
                db.Entry(product).State = EntityState.Modified;
                await db.SaveChangesAsync(CancellationToken.None);

                //Invalidate the cache entry as it is modified
                MemoryCache.Default.Remove(string.Format("product_{0}", product.ProductId));
                return(RedirectToAction("Index"));
            }

            ViewBag.Categories = new SelectList(db.Categories, "CategoryId", "Name", product.CategoryId);
            return(View(product));
        }
        public async Task <IActionResult> Edit(Product product)
        {
            if (ModelState.IsValid)
            {
                _db.Entry(product).State = EntityState.Modified;
                await _db.SaveChangesAsync(HttpContext.RequestAborted);

                //Invalidate the cache entry as it is modified
                _cache.Remove(string.Format("product_{0}", product.ProductId));
                return(RedirectToAction("Index"));
            }

            ViewBag.Categories = new SelectList(_db.Categories, "CategoryId", "Name", product.CategoryId);
            return(View(product));
        }