Exemplo n.º 1
0
        public ActionResult FlightSearchStart(int id)
        {
            SessionService sessionService = new SessionService();

            if (!sessionService.ItemExists(SessionEnum.FlightSearch, id.ToString()))
            {
                // ah error has happend the session has gone
                // now we could be clever here and get the search back out of the database and restart it
                throw new Exception("Session Gone");
            }

            var flightSearchResult = sessionService.GetItem <FlightSearchResult>(SessionEnum.FlightSearch, id.ToString());

            // lets do the search
            flightSearchResult = flightServiceClient.PerformSearch(flightSearchResult.FlightSearch, flightSearchResult.FlightSearchId);
            sessionService.SetItem(SessionEnum.FlightSearch, id.ToString(), flightSearchResult);
            return(Json(new { success = flightSearchResult.Success, error = flightSearchResult.ErrorMessage }));
        }