public async Task <IActionResult> Edit(int id, [Bind("Id,LastName,FirstName,SurName,Email")] Manager manager) { if (id != manager.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(manager); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ManagerExists(manager.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(manager)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,LastName,FirstName,SurName,BirthDay,Address")] Tourist tourist) { if (id != tourist.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tourist); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TouristExists(tourist.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(tourist)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,CountryName,InfoVisa")] 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,TourName,TourDuration,ManagerId,HotelId")] Tour tour) { if (id != tour.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tour); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TourExists(tour.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["HotelId"] = new SelectList(_context.Hotels, "Id", "HotelName", tour.HotelId); ViewData["ManagerId"] = new SelectList(_context.Managers, "Id", "Id", tour.ManagerId); return(View(tour)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,HotelName,Stars,CityId,RoomType")] Hotel hotel) { if (id != hotel.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(hotel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HotelExists(hotel.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CityId"] = new SelectList(_context.Cities, "Id", "CityName", hotel.CityId); return(View(hotel)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,TourId,TouristId,Price,BuyDate,StartDate")] Voucher voucher) { if (id != voucher.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(voucher); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VoucherExists(voucher.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["TourId"] = new SelectList(_context.Tours, "Id", "TourName", voucher.TourId); ViewData["TouristId"] = new SelectList(_context.Tourists, "Id", "Id", voucher.TouristId); return(View(voucher)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,CityName,CountryId")] 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["CountryId"] = new SelectList(_context.Countries, "Id", "CountryName", city.CountryId); return(View(city)); }