예제 #1
0
        // 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()));
        }
예제 #2
0
        // 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));
        }
예제 #3
0
        /// <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));
        }
예제 #4
0
        // 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));
        }
예제 #5
0
        /// <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()));
        }
예제 #6
0
        // 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));
        }
예제 #7
0
        // 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));
        }
예제 #8
0
        // 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));
        }
예제 #9
0
        // 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));
        }
예제 #10
0
 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 }));
     }
 }
예제 #11
0
        // 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));
        }
예제 #12
0
        public HttpResponseMessage Get()
        {
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, _hotelManager.GetHotels());

            return(response);
        }
예제 #13
0
 // 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());
 }
예제 #14
0
 // GET: Hotels
 public async Task <IActionResult> Index()
 {
     return(View(await _context.GetHotels()));
 }
 public async Task <ActionResult <IEnumerable <HotelDto> > > GetHotels()
 {
     return(await _hotel.GetHotels());
 }
예제 #16
0
 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());
 }
예제 #19
0
        /// <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)));
        }