// GET: Hotels/Details/5 /// <summary> /// Find hotel details by id. If id is not 0, get the hotel by id. /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task<IActionResult> Details(int id) { if (id <= 0) { return NotFound(); } Hotel hotel = await _context.GetHotelById(id); var hotelRooms = _context.GetHotelRooms(id); RoomHotelVM rhvm = new RoomHotelVM(); rhvm.Hotel = hotel; rhvm.HotelRoom = hotelRooms; if (hotel == null) { return NotFound(); } return View(rhvm); }
// GET: Hotels/Details/5 public async Task <IActionResult> Details(int id) { var hotel = await _hotels.GetHotel(id); if (hotel == null) { return(NotFound()); } ViewData["HotelRooms"] = await _hotels.GetHotelRooms(id); return(View(hotel)); }