public async Task <IActionResult> Edit(int id, [Bind("AmenitiesID,RoomID")] RoomAmenities roomAmenities) { if (id != roomAmenities.AmenitiesID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(roomAmenities); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RoomAmenitiesExists(roomAmenities.AmenitiesID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AmenitiesID"] = new SelectList(_context.Amenities, "ID", "Name", roomAmenities.AmenitiesID); ViewData["RoomID"] = new SelectList(_context.Room, "ID", "Name", roomAmenities.RoomID); return(View(roomAmenities)); }
public async Task <IActionResult> Edit(int id, [Bind("HotelID,RoomNumber,RoomID,Rate,PetFriendly")] HotelRoom hotelRoom) { if (id != hotelRoom.HotelID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(hotelRoom); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HotelRoomExists(hotelRoom.HotelID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["HotelID"] = new SelectList(_context.Hotel, "ID", "Name", hotelRoom.HotelID); ViewData["RoomID"] = new SelectList(_context.Room, "ID", "Name"); return(View(hotelRoom)); }
/// <summary> /// will update a selected amenity /// </summary> /// <param name="id">selected amenity</param> /// <param name="amenities">the amenity object</param> /// <returns>the task to controller</returns> public async Task UpdateAmenitie(int id, Amenities amenities) { try { _context.Update(amenities); await _context.SaveChangesAsync(); } catch (Exception e) { Console.WriteLine(e); } }
public async Task UpdateHotel(int id, [Bind("ID,Name,StreetAdress,City,State,Phone")] Hotel hotel) { try { _context.Update(hotel); await _context.SaveChangesAsync(); } catch (Exception e) { Console.WriteLine(e); } }
public async Task UpdateRoom(int id, [Bind("ID,Name,RoomLayout")] Room hotel) { _context.Update(hotel); await _context.SaveChangesAsync(); }