Ejemplo n.º 1
0
        public ActionResult AdvancedList(AdvancedSearchVM asvm)
        {
            // Verify checkin and checkout
            DateTime emptyDate = new DateTime(0001, 01, 01, 00, 00, 00);

            if (asvm.CheckIn == emptyDate || asvm.CheckOut == emptyDate)
            {
                TempData["Error"] = "Please check your checkin and checkout dates.";
                return(RedirectToAction("Index", "Home"));
            }

            // Get rooms and display them
            List <Room> rooms;

            using (HttpClient httpClient = new HttpClient())
            {
                Task <String> response = httpClient.GetStringAsync(baseUri + asvm.ToString());
                rooms = JsonConvert.DeserializeObject <List <Room> >(response.Result);
            }

            if (rooms.Count == 0)
            {
                TempData["Error"] = "No rooms found matching your wishes";
            }

            return(View("List", GetRoomSelectedVM(rooms, asvm)));
        }
Ejemplo n.º 2
0
        // Advanced search
        public ActionResult Search()
        {
            AdvancedSearchVM asvm = new AdvancedSearchVM();

            asvm.Locations = getLocations();

            return(View(asvm));
        }