public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Route route) { if (id != route.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(route); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RouteExists(route.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(route)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,RoleId,FirstName,LastName,UserName,Password,BusId")] User user) { if (id != user.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(user); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(user.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BusId"] = new SelectList(_context.Bus, "Id", "LicencePlate", user.BusId); ViewData["RoleId"] = new SelectList(_context.Role, "Id", "Name", user.RoleId); return(View(user)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,BusId,RouteId")] BusRoute busRoute) { if (id != busRoute.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(busRoute); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BusRouteExists(busRoute.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BusId"] = new SelectList(_context.Bus, "Id", "LicencePlate", busRoute.BusId); ViewData["RouteId"] = new SelectList(_context.Route, "Id", "Name", busRoute.RouteId); return(View(busRoute)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,CheckPointId,BusId,UserId,RecorDate")] ControlRecord controlRecord) { if (id != controlRecord.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(controlRecord); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ControlRecordExists(controlRecord.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BusId"] = new SelectList(_context.Bus, "Id", "LicencePlate", controlRecord.BusId); ViewData["CheckPointId"] = new SelectList(_context.CheckPoint, "Id", "Name", controlRecord.CheckPointId); ViewData["UserId"] = new SelectList(_context.User, "Id", "FirstName", controlRecord.UserId); return(View(controlRecord)); }