Exemplo n.º 1
0
        public ActionResult Index(SearchInputModel model)
        {
            if (!this.ModelState.IsValid)
            {
                return this.View(model);
            }

            this.Session["SearchDates"] = model;

            return this.RedirectToAction("List", "Reservations", model);
        }
Exemplo n.º 2
0
        public ActionResult List(SearchInputModel model)
        {
            if (model.Start == DateTime.MinValue)
            {
                return this.RedirectToAction("Index", "Home");
            }

            var availableRooms = this.rooms
                .AvailableForPeriod(model.Start, model.End).To<RoomViewModel>();

            var roomList = new Dictionary<RoomViewModel, int>();
            var roomstoDict = availableRooms.GroupBy(x => x.Price);

            foreach (var group in roomstoDict)
            {
                roomList.Add(group.FirstOrDefault(), group.Count());
            }

            return this.View(roomList);
        }