public async Task <IActionResult> Edit(int id, [Bind("Id,StartDate,EndDate,ApplicationUserId,RoomId")] 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["ApplicationUserId"] = new SelectList(_context.Users, "Id", "Id", booking.ApplicationUserId); ViewData["RoomId"] = new SelectList(_context.Room, "Id", "RoomNumber", booking.RoomId); return(View(booking)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,RoomNumber,Description,RoomType,RoomSize")] Room room) { if (id != room.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(room); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RoomExists(room.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(room)); }