public async Task <IActionResult> Edit(int id, [Bind("Id,Identity")] Make make) { if (id != make.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(make); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MakeExists(make.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(make)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,PrimaryPhone,AlternatePhone,Email,Street,City,State,Zip,RoleId")] Employee employee) { if (id != employee.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(employee); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeeExists(employee.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["RoleId"] = new SelectList(_context.Roles, "Id", "Identity", employee.RoleId); return(View(employee)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,PrimaryPhone,AlternatePhone,CarrierId,Email,Street,City,State,Zip,ContactMethod")] 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))); } ViewData["CarrierId"] = new SelectList(_context.Carriers, "Id", "Identity", customer.CarrierId); return(View(customer)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,CustomerId,EmployeeId,MakeId,ModelId,ColorId,Status,RepairId,IMEI")] Ticket ticket) { if (id != ticket.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(ticket); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TicketExists(ticket.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ColorId"] = new SelectList(_context.Colors, "Id", "Identity", ticket.ColorId); ViewData["CustomerId"] = new SelectList(_context.Customers, "Id", "FullName", ticket.CustomerId); ViewData["EmployeeId"] = new SelectList(_context.Employees, "Id", "FullName", ticket.EmployeeId); ViewData["MakeId"] = new SelectList(_context.Makes, "Id", "Identity", ticket.MakeId); ViewData["ModelId"] = new SelectList(_context.Models, "Id", "Identity", ticket.ModelId); ViewData["RepairId"] = new SelectList(_context.Repairs, "Id", "Identity", ticket.RepairId); return(View(ticket)); }