public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Comments")] Meal meal) { if (id != meal.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(meal); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MealExists(meal.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(meal)); }
public async Task <IActionResult> Edit(int id, [Bind("TableCategoryId,TableCapacity")] TableCategory tableCategory) { if (id != tableCategory.TableCategoryId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tableCategory); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TableCategoryExists(tableCategory.TableCategoryId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(tableCategory)); }
public async Task <IActionResult> Edit(int id, [Bind("TableId,TableCategoryId,IsBooked")] Table table) { if (id != table.TableId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(table); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TableExists(table.TableId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["TableCategoryId"] = new SelectList(_context.TableCategories, "TableCategoryId", "TableCategoryId", table.TableCategoryId); return(View(table)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Chef chef) { if (id != chef.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(chef); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ChefExists(chef.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(chef)); }
public async Task <IActionResult> Edit(int id, [Bind("BookingId,BookingDate,CustomerId,TableId")] Booking booking) { if (id != booking.BookingId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(booking); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookingExists(booking.BookingId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Customers, "CustomerId", "CustomerId", booking.CustomerId); ViewData["TableId"] = new SelectList(_context.Tables, "TableId", "TableId", booking.TableId); return(View(booking)); }
public async Task <IActionResult> Edit(int id, [Bind("CustomerId,CustomerName,Address,PhoneNumber,EmailAddress,GroupCount")] Customer customer) { if (id != customer.CustomerId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(customer.CustomerId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(customer)); }
public void Update(MenuItem item) { MenuItem itemToUpdate = context.MenuItems.FirstOrDefault(d => d.Id == item.Id); itemToUpdate.Name = item.Name; itemToUpdate.Description = item.Description; itemToUpdate.Price = item.Price; context.Update(itemToUpdate); context.SaveChanges(); }
public IActionResult UpdateMenu([FromBody] Menu menu) { _context.Update(menu); _context.SaveChanges(); return(new OkResult()); }
public void Update(Restaurant restaurant) { _dbContext.Update(restaurant); _dbContext.SaveChanges(); }
public IActionResult Update(Reservation r) { _context.Update(r); _context.SaveChanges(); return(RedirectToAction("Details")); }
public IActionResult UpdateVoucher([FromBody] Vouchers voucher) { _context.Update(voucher); _context.SaveChanges(); return(new OkResult()); }