// GET: Hotels/Details/5 public async Task <IActionResult> Details(int id) { if (id <= 0) { return(NotFound()); } Hotel hotel = await _context.GetHotelById(id); if (hotel == null) { return(NotFound()); } return(View(hotel)); }
// 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); }
public IHttpActionResult Get(int id) { try { //Throws an exception if no record found var hotel = _hotelManager.GetHotelById(id); return(Ok(hotel)); } catch (Exception ex) { Console.WriteLine(ex); return(Json(new Models.Hotel() { })); } }
public async Task <IActionResult> HotelDetails(int id) { var result = await _hotel.GetHotelById(id); return(View(result)); }