Example #1
0
        public async Task <ActionResult> Edit([Bind(Include = "RaincheckId,Name,ProductId,Quantity,SalePrice,StoreId")]
                                              RainCheck rainCheck)
        {
            if (ModelState.IsValid)
            {
                _db.Entry(rainCheck).State = EntityState.Modified;
                await _db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.StoreId   = new SelectList(_db.Stores, "StoreId", "Name", rainCheck.StoreId);
            ViewBag.ProductId = new SelectList(_db.Products, "ProductId", "SkuNumber", rainCheck.ProductId);
            return(View(rainCheck));
        }
Example #2
0
        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));
        }
Example #3
0
        public async Task <ActionResult> Edit(
            [Bind(Include =
                      "ProductId,SkuNumber,RecommendationId,CategoryId,Title,Price,SalePrice,ProductArtUrl,Created,Description,ProductDetails,Inventory,LeadTime")]
            Product product)
        {
            if (ModelState.IsValid)
            {
                _db.Entry(product).State = EntityState.Modified;
                await _db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

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