public async Task <IActionResult> Edit(int id, [Bind("ID,name")] Wine wine) { if (id != wine.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(wine); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WineExists(wine.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(wine)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,BrandID,name,price,liter")] Product product) { if (id != product.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(product); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductExists(product.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BrandID"] = new SelectList(_context.Brand, "ID", "ID", product.BrandID); return(View(product)); }