示例#1
0
        public IActionResult Edit(int id, [Bind("GummiId,Name,Price,Description")] Gummi gummi)
        {
            if (id != gummi.GummiId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Edit(gummi);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GummiExists(gummi.GummiId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(gummi));
        }
示例#2
0
 public IActionResult Edit(int id, Product product)
 {
     productRepo.Edit(product);
     ViewData["CategoryId"] = new SelectList(productRepo.Categories, "CategoryId", "CategoryId", product.CategoryId);
     return(RedirectToAction("Index"));
 }