Beispiel #1
0
        public ActionResult Search(FlightSearchResult fg)
        {
            // return fg.FlightDate.ToShortDateString()+ " "+fg.Boarding+" "+fg.Landing+""+fg.NoOfPassangers;

            List <FlightChild> flights = new List <FlightChild>();
            FlightChild        flight  = null;
            String             s       = fg.FlightDate.ToString();

            TempData["start"] = fg.Boarding;
            TempData.Keep();
            TempData["end"] = fg.Landing;
            TempData.Keep();
            if ((fg.Boarding != null) && (fg.Landing != null))
            {
                try
                {
                    List <SearchFlight> modelFlights = bl.getDetails(fg.FlightDate.ToShortDateString(), fg.Boarding, fg.Landing);

                    if (String.Equals(fg.Boarding, fg.Landing))
                    {
                        ViewBag.Mesage = "Source And destination are same.Please try again ";
                    }
                    foreach (SearchFlight item in modelFlights)
                    {
                        flight               = new FlightChild();
                        flight.Flightid      = item.Flightid;
                        flight.Departuretime = item.Departuretime;
                        flight.Arrivaltime   = item.Arrivaltime;
                        flight.Duration      = item.Duration;
                        flight.Fare          = item.Fare;
                        flights.Add(flight);
                    }
                }
                catch (NoFlightInDatabaseException noflightException)
                {
                    ViewBag.Message = noflightException.Message;
                }
                catch (Exception exception)
                {
                    ViewBag.Message = exception.Message;
                }
            }
            else
            {
                ViewBag.Message = "Invalid source and destination.Try Again!!!!";
            }
            return(View("SearchFlightPage", flights));
        }
 public ActionResult SearchFlightPage(FlightChild fl)
 {
     return(View(fl));
 }
Beispiel #3
0
        public ActionResult SearchFlightPage(FlightChild fl)
        {
            //Session["id"] =fl.Flightid;

            return(View(fl));
        }