public async Task <IActionResult> Edit(long id, [Bind("Id,Name,Description,Price,Batch,Type,SupplierId")] Product product) { if (id != product.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(product); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!_context.ProductExists(product.Id)) { return(NotFound()); } throw; } return(RedirectToAction(nameof(Index))); } ViewData["SupplierId"] = new SelectList(_context.Suppliers, "Id", "Name", product.SupplierId); return(View(product)); }