public async Task <IActionResult> Edit(int id, [Bind("Id,Name,HotelTypeId,CountryId,Description,Rating,AllowGroups,Activities,OnlyAdults")] 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["CountryId"] = new SelectList(_context.Country, "Id", "Name", hotel.CountryId); ViewData["HotelTypeId"] = new SelectList(_context.HotelType, "Id", "Name", hotel.HotelTypeId); return(View(hotel)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Template")] HotelType hotelType) { if (id != hotelType.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(hotelType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HotelTypeExists(hotelType.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(hotelType)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,CustomerId,PaxesCount,StartDate,EndDate,Profit,Currency,CountryId")] Booking booking) { if (id != booking.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(booking); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookingExists(booking.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Customer, "Id", "Name", booking.CustomerId); return(View(booking)); }
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)); }