public async Task <IActionResult> Edit(int id, [Bind("ID,Address,Contact,Email")] Store store) { if (id != store.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(store); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StoreExists(store.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(store)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,CustomerID,StaffID,FoodID,StoreID")] Order order) { if (id != order.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(order); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderExists(order.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CustomerID"] = new SelectList(_context.Customer, "ID", "ID", order.CustomerID); ViewData["FoodID"] = new SelectList(_context.Food, "ID", "ID", order.FoodID); ViewData["StaffID"] = new SelectList(_context.Set <Staff>(), "ID", "ID", order.StaffID); ViewData["StoreID"] = new SelectList(_context.Set <Store>(), "ID", "ID", order.StoreID); return(View(order)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,First_Name,Last_Name,Gender,DOB")] Customer customer) { if (id != customer.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(customer.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(customer)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Food_Name,Food_Type,Food_Quantity,Price")] Food food) { if (id != food.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(food); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FoodExists(food.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(food)); }