public IActionResult Edit(int id, [Bind("StartDate,EndDate,IsActive,CustomerId,RoomId")] Booking booking) { if (id != booking.Id) { return(NotFound()); } if (ModelState.IsValid) { try { bookingManager.EditBooking(booking); } catch (DbUpdateConcurrencyException) { if (bookingManager.GetBooking(booking.Id) == null) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(customerManager.GetAllCustomers(), "Id", "Name", booking.CustomerId); ViewData["RoomId"] = new SelectList(roomManager.GetAll(), "Id", "Description", booking.RoomId); return(View(booking)); }