public async Task <IActionResult> Edit(int id, [Bind("Id,Name,EmailAddress,Mobile")] 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,DeliveryAgentId,LunchPackId,CustomerId,NumberOfPacks,Address")] OnlineDelivery onlineDelivery) { if (id != onlineDelivery.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(onlineDelivery); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OnlineDeliveryExists(onlineDelivery.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Customer, "Id", "Id", onlineDelivery.CustomerId); ViewData["DeliveryAgentId"] = new SelectList(_context.DeliveryAgent, "Id", "Id", onlineDelivery.DeliveryAgentId); ViewData["LunchPackId"] = new SelectList(_context.LunchPack, "Id", "Id", onlineDelivery.LunchPackId); return(View(onlineDelivery)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Description,Price")] LunchPack lunchPack) { if (id != lunchPack.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(lunchPack); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LunchPackExists(lunchPack.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(lunchPack)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Mobile")] DeliveryAgent deliveryAgent) { if (id != deliveryAgent.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(deliveryAgent); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DeliveryAgentExists(deliveryAgent.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(deliveryAgent)); }