Exemplo n.º 1
0
        public async Task <IActionResult> SearchFlight(SearchFlight vm)
        {
            //var to keep search input for flight results use
            var searchFlightTemp = new SearchFlight
            {
                OriginID     = vm.OriginID,
                DestID       = vm.DestID,
                WaySelection = vm.WaySelection,
                DepartDate   = vm.DepartDate,
                ReturnDate   = vm.ReturnDate
            };

            _globalRepo.SaveObjToSessionJSON <SearchFlight>("searchFlightTemp", searchFlightTemp);

            HttpContext.Session.SetInt32("adultNum", vm.AdultNum);
            HttpContext.Session.SetInt32("childrenNum", vm.ChildrenNum);

            //get the result of search input
            var result = await _flightRepo.GetBySearchInput(vm);

            //subscribe to signalR real time update of item addition to Booking Table
            //_bookingRepo.subscribeBookingAdd();

            //copy and bring over variables needed for next view
            result.OriginName = vm.OriginName;
            result.DestName   = vm.DestName;

            return(View("FlightResults", result));
        }