public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Price,Unit,ExpiryDate")] 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))); } return(View(product)); }