public async Task <IActionResult> Edit(int id)
        {
            // Get product with corresponding id
            Product p = await ProductDb.GetSingleProductAsync(_context, id);

            // pass product to view
            return(View(p));
        }
        /// <summary>
        /// Adds a product to the shopping cart
        /// </summary>
        /// <param name="id">The id of the product to add</param>
        /// <returns></returns>
        public async Task <IActionResult> Add(int id)
        {
            Product p = await ProductDb.GetSingleProductAsync(_context, id);

            CookieHelper.AddProductToCart(_httpContext, p);

            // Redirect back to previous page
            return(RedirectToAction("Index", "Product"));
        }
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            Product p = await ProductDb.GetSingleProductAsync(_context, id);

            _context.Entry(p).State = EntityState.Deleted;
            await _context.SaveChangesAsync();

            TempData["Message"] = $"{p.Title} was deleted";

            return(RedirectToAction("Index"));
        }
        public async Task <IActionResult> Delete(int id)
        {
            Product p = await ProductDb.GetSingleProductAsync(_context, id);

            return(View(p));
        }