public async Task <IActionResult> Edit(string id, [Bind("UserName,Age,Password")] User user) { if (id != user.UserName) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(user); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(user.UserName)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(user)); }
public async Task <IActionResult> Edit(int id, [Bind("CategoryId,CategoryName,Description")] Category category) { if (id != category.CategoryId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(category); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(category.CategoryId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(category)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ZipCode,PostalAddress,PaymentCard,Cvv")] 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))); } return(View(order)); }
public async Task <IActionResult> Edit(string id, [Bind("ShoppingCartItemId,Amount,ShoppingCartId")] ShoppingCartItem shoppingCartItem) { if (id != shoppingCartItem.ShoppingCartItemId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(shoppingCartItem); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ShoppingCartItemExists(shoppingCartItem.ShoppingCartItemId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(shoppingCartItem)); }
public async Task <IActionResult> Edit(int id, [Bind("DrinkId,Name,ShortDescription,LongDescription,Price,ImageUrl,ImageThumbnailUrl,IsPreferredDrink,InStock,CategoryId")] Drink drink) { if (id != drink.DrinkId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(drink); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DrinkExists(drink.DrinkId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CategoryId"] = new SelectList(_context.Category, "CategoryId", "CategoryId", drink.CategoryId); return(View(drink)); }
public async Task <IActionResult> Edit(int id, [Bind("OrderDetailId,DrinkId,OrderId,Amount,Price")] OrderDetail orderDetail) { if (id != orderDetail.OrderDetailId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(orderDetail); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderDetailExists(orderDetail.OrderDetailId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DrinkId"] = new SelectList(_context.Drink, "DrinkId", "DrinkId", orderDetail.DrinkId); ViewData["OrderId"] = new SelectList(_context.Order, "OrderId", "OrderId", orderDetail.OrderId); return(View(orderDetail)); }
public async Task <IActionResult> Edit(string id, [Bind("Name,RealAdress,Adress")] Store store) { if (id != store.Name) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(store); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StoreExists(store.Name)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(store)); }