// GET: Hotel public async Task <IActionResult> Index(string searchString) { var hotel = await _context.GetHotels(); if (!String.IsNullOrEmpty(searchString)) { hotel = hotel.Where(am => am.Name.Contains(searchString)); } return(View(hotel.ToList())); }
// GET: Hotel public IActionResult Index(string searchString) { var hotel = _context.GetHotels(); if (!String.IsNullOrEmpty(searchString)) { hotel = hotel.Where(s => s.Name.Contains(searchString)); } return(View(hotel)); }
/// <summary> /// Create search bar /// </summary> /// <param name="searchString"></param> /// <returns></returns> public async Task <IActionResult> Index(string searchString) { if (searchString == null) { return(View(await _context.GetHotels())); } var hotels = await _context.GetHotels(); if (!String.IsNullOrEmpty(searchString)) { hotels = hotels.Where(h => h.Name.ToLower().Contains(searchString.ToLower())); } return(View(hotels)); }
// GET: Hotels public async Task <IActionResult> Index(string searchString) { var hotelselect = from h in await _hotels.GetHotels() select h; if (!String.IsNullOrEmpty(searchString)) { hotelselect = hotelselect.Where(s => s.Name.Contains(searchString)); } List <Hotel> myHotels = await _hotels.GetHotels(); int count = myHotels.Count(); return(View(hotelselect)); }
/// <summary> /// Handles both the search and show all methods /// </summary> /// <param name="SearchString"></param> /// <returns></returns> public async Task <IActionResult> Index(string SearchString) { if (!String.IsNullOrEmpty(SearchString)) { return(View(await _context.SearchHotels(SearchString))); } return(View(await _context.GetHotels())); }
// GET: Hotels public async Task <IActionResult> Index() { //TODO Either add searchString param to this method to enable user to search by City or List <Hotel> myHotels = await _hotels.GetHotels(); return(View(myHotels)); }
// GET: Hotels public async Task <IActionResult> Index(string searchString) { var hotels = await _context.GetHotels(); if (!String.IsNullOrEmpty(searchString)) { hotels = hotels.Where(s => s.Name.Contains(searchString) || s.FormattedAddress.Contains(searchString)); } return(View(hotels)); }
// GET: Hotels public async Task <IActionResult> Index(string searchString) { List <Hotel> myHotels = await _hotels.GetHotels(searchString); var hotels = new HotelCount() { Hotels = myHotels, Count = myHotels.Count() }; return(View(hotels)); }
// GET: Hotels /// <summary> /// gets hotels /// </summary> /// <param name="searchstring">string optional</param> /// <returns>hotels</returns> public async Task <IActionResult> Index(string searchstring) { IEnumerable <Hotel> Hotels = await _context.GetHotels(); var hotels = from m in Hotels select m; if (!String.IsNullOrEmpty(searchstring)) { hotels = hotels.Where(s => s.Name.Contains(searchstring)); } return(View(hotels)); }
public IHttpActionResult GetHotels() { try { List <HotelViewModel> hotels = _hotelManager.GetHotels(); if (hotels.Count == 0 || hotels == null) { return(Json("No records found")); } return(Json(hotels)); } catch (Exception e) { return(Content(HttpStatusCode.InternalServerError, new { message = e.Message })); } }
// GET: Hotels //public async Task<IActionResult> Index() //{ // return View(await _context.GetHotels()); //} public async Task <IActionResult> Index(string NameEntered) { var hotels = await _context.GetHotels(); if (!String.IsNullOrEmpty(NameEntered)) { hotels = hotels.Where(search => search.Name.Contains(NameEntered)); } //Not using viewbag any more, just going to dynamically generate the room count every time Index is loaded. Probably not the DRY-est way to do this but it works for now? foreach (Hotel hotel in hotels) { hotel.RoomCount = _context.RoomCount(hotel); } return(View(hotels)); }
public HttpResponseMessage Get() { HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, _hotelManager.GetHotels()); return(response); }
// GET: HotelRooms/Create public async Task <IActionResult> Create() { ViewData["HotelID"] = new SelectList(await _hotels.GetHotels(), "ID", "Name"); ViewData["RoomID"] = new SelectList(await _rooms.GetRooms(), "ID", "Name"); return(View()); }
// GET: Hotels public async Task <IActionResult> Index() { return(View(await _context.GetHotels())); }
public async Task <ActionResult <IEnumerable <HotelDto> > > GetHotels() { return(await _hotel.GetHotels()); }
public IEnumerable <HotelViewModel> Get() { return(_hotelManager.GetHotels()); }
public IHttpActionResult Get() { var response = _hotelmanager.GetHotels(); return(Ok(response)); }
public async Task <List <Hotel> > GetHotels() { return(await _hotel.GetHotels()); }
/// <summary> /// Action To Show The Details Of Hotel /// </summary> /// <param name="page"></param> /// <returns></returns> public ActionResult Index(int?page) { List <Hotel> hotels = hotelManager.GetHotels().ToList <Hotel>(); return(View(hotels.ToPagedList((page ?? 1), 8))); }