/// <summary> /// Generate report by ItineraryId /// </summary> /// <param name="itineraryId"></param> /// <returns></returns> public ActionResult GenerateReport(long itineraryId) { _airportsRepository = new AirportsRepository(); _itinerarysRepository = new ItinerarysRepository(); _usersRepository = new UsersRepository(); var itineraryInfo = _itinerarysRepository.Get(itineraryId); var userInfo = new Users(); _listF = new List <Flights>(); if (itineraryInfo != null) { userInfo = _usersRepository.Get(itineraryInfo.UserID); foreach (var flight in itineraryInfo.Flights) { flight.DepartureLocation = _airportsRepository.Get(flight.DepartureLocation).AirportID; flight.ArrivalLocation = _airportsRepository.Get(flight.ArrivalLocation).AirportID; } } ViewBag.itineraryInfo = itineraryInfo; return(View()); }
public ActionResult Edit(long id) { _itinerarysRepository = new ItinerarysRepository(); _flightsRepository = new FlightsRepository(); ViewBag.flightList = _flightsRepository.GetFlightsByItinerary(id); return(View(_itinerarysRepository.Get(id))); }
public ActionResult Edit(Itinerary model) { if (ModelState.IsValid) { _itinerarysRepository = new ItinerarysRepository(); var currentItinerary = _itinerarysRepository.Get(model.ItineraryID); model.From = currentItinerary.From; model.To = currentItinerary.To; model.RetStops = currentItinerary.RetStops; model.TripType = currentItinerary.TripType; model.PassengerID = currentItinerary.PassengerID; _itinerarysRepository.Update(model); ViewBag.SuccessMessage = "The itinerary was updated successfully."; } _flightsRepository = new FlightsRepository(); ViewBag.flightList = _flightsRepository.GetFlightsByItinerary(model.ItineraryID); return(View(model)); }