public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Country country) { if (id != country.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(country); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CountryExists(country.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(country)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Price,CarriageNumber,Depart,Arrive,UserId")] 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["Arrive"] = new SelectList(_context.Arrivaltime, "Id", "Id", ticket.Arrive); ViewData["Depart"] = new SelectList(_context.Arrivaltime, "Id", "Id", ticket.Depart); ViewData["UserId"] = new SelectList(_context.User, "Id", "FirstName", ticket.UserId); return(View(ticket)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,PrefixId,CityId")] Station station) { if (id != station.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(station); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StationExists(station.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CityId"] = new SelectList(_context.City, "Id", "Name", station.CityId); ViewData["PrefixId"] = new SelectList(_context.Prefix, "Id", "Value", station.PrefixId); return(View(station)); }
public async Task <IActionResult> Edit(string id, [Bind("Id,FirstName,LastName,MiddleName,PassportSerial")] 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))); } return(View(user)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ArriveTime,PointId,TripId")] Arrivaltime arrivaltime) { if (id != arrivaltime.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(arrivaltime); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ArrivaltimeExists(arrivaltime.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["PointId"] = new SelectList(_context.Point, "Id", "Id", arrivaltime.PointId); ViewData["TripId"] = new SelectList(_context.Trip, "Id", "Id", arrivaltime.TripId); return(View(arrivaltime)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,LocomotiveId")] Trip trip) { if (id != trip.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(trip); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TripExists(trip.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["LocomotiveId"] = new SelectList(_context.Locomotive, "Id", "Id", trip.LocomotiveId); return(View(trip)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,StayTime,TripDistance,RouteId,StationId")] Point point) { if (id != point.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(point); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PointExists(point.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["RouteId"] = new SelectList(_context.Route, "Id", "Name", point.RouteId); ViewData["StationId"] = new SelectList(_context.Station, "Id", "Name", point.StationId); return(View(point)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,RegionId")] City city) { if (id != city.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(city); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CityExists(city.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["RegionId"] = new SelectList(_context.Region, "Id", "Name", city.RegionId); return(View(city)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,CarriageId,LocomotiveId,FreeSeats")] CarriageHasLocomotive carriageHasLocomotive) { if (id != carriageHasLocomotive.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(carriageHasLocomotive); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CarriageHasLocomotiveExists(carriageHasLocomotive.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CarriageId"] = new SelectList(_context.Carriage, "Id", "Id", carriageHasLocomotive.CarriageId); ViewData["LocomotiveId"] = new SelectList(_context.Locomotive, "Id", "Id", carriageHasLocomotive.LocomotiveId); return(View(carriageHasLocomotive)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,PricePerKilometer")] Locomotive locomotive) { if (id != locomotive.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(locomotive); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LocomotiveExists(locomotive.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(locomotive)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,CountryId")] Region region) { if (id != region.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(region); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RegionExists(region.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CountryId"] = new SelectList(_context.Country, "Id", "Name", region.CountryId); return(View(region)); }