public async Task <IActionResult> Edit(int id, [Bind("TicketId,Price,StaffEntityId")] Ticket ticket) { if (id != ticket.TicketId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(ticket); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TicketExists(ticket.TicketId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["StaffEntityId"] = new SelectList(_context.StaffEntities, "StaffEntityId", "Email", ticket.StaffEntityId); return(View(ticket)); }
public async Task <IActionResult> Edit(int id, [Bind("StaffEntityId,Firstname,Lastname,Email")] StaffEntity staffEntity) { if (id != staffEntity.StaffEntityId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(staffEntity); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StaffEntityExists(staffEntity.StaffEntityId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(staffEntity)); }