コード例 #1
0
        public IActionResult Flights(FlightsViewModel model)
        {
            model.VoyagerUserID = ckLoginUser_Id;
            PositionSetRes objPositionSetRes = positionMapping.SetFlightsDetals(model, ckUserEmailId, token);

            if (model.SaveType == "partial")
            {
                var objPosition = objPositionSetRes.mPosition.FirstOrDefault();
                return(Json(new { objPositionSetRes.ResponseStatus.Status, PositionId = objPosition.PositionId, RoomDetailsInfo = objPosition.RoomDetailsInfo }));
            }
            else
            {
                if (objPositionSetRes.ResponseStatus.Status.ToLower() == "success")
                {
                    TempData["success"] = "Flight " + objPositionSetRes.ResponseStatus.ErrorMessage;
                }
                else
                {
                    TempData["error"] = objPositionSetRes.ResponseStatus.ErrorMessage;
                }

                model.SaveType = "full";
                if (model.FlightDetails.Count == 1)
                {
                    return(RedirectToAction("Flights", new { QRFId = model.QRFID, model.SaveType, PositionId = model.FlightDetails[0].PositionId, IsClone = model.MenuViewModel.IsClone }));
                }
                else
                {
                    return(RedirectToAction("Flights", new { QRFId = model.QRFID, model.SaveType, IsClone = model.MenuViewModel.IsClone }));
                }
            }
        }
コード例 #2
0
        public async Task <IActionResult> DeleteF(int IdC, int IdF)
        {
            if (IdC == null && IdF == null)
            {
                return(NotFound());
            }

            var flightBooking = new FlightsViewModel()
            {
                IdC         = IdC,
                IdF         = IdF,
                Attended    = true,
                Date        = DateTime.Now,
                Destination = "New York",
                Duration    = "10h",
                FNumber     = "199605"
            };

            if (flightBooking == null)
            {
                return(NotFound());
            }

            return(View(flightBooking));
        }
コード例 #3
0
ファイル: FlightController.cs プロジェクト: yong-12/flight
        public ViewResult Save(Flight FlightMV)
        {
            if (!ModelState.IsValid)
            {
                var NewFlightMV = new NewFlightViewModel()
                {
                    AircraftId           = FlightMV.AircraftId,
                    AirportDepartId      = FlightMV.AirportDepartId,
                    AirportDestinationId = FlightMV.AirportDestinationId,
                    Distance             = FlightMV.Distance,
                    FuelNeeded           = FlightMV.FuelNeeded,
                    Aircrafts            = _aircraftRepository.Aircrafts.OrderBy(a => a.AircraftId),
                    Airport = _airportRepository.Airports.OrderBy(a => a.Name)
                };

                return(View("FlightForm", NewFlightMV));
            }

            if (FlightMV.FlightId == 0)
            {
                _flightRepository.AddFlight(FlightMV);
            }
            else
            {
                _flightRepository.UpdateFlight(FlightMV);
            }


            var mv = new FlightsViewModel()
            {
                Flights = _flightRepository.Flights.OrderBy(f => f.FlightId)
            };

            return(View("Index", mv));
        }
コード例 #4
0
 private void GetCollectionsDataFromDB()
 {
     FlightsViewModel.GetAllCompanies().ForEach(c => Companies.Add(c.name));
     FlightsViewModel.GetAllCities().ForEach(c => Cities.Add(c));
     FlightsViewModel.GetExistingPlanes().ForEach(p => Planes.Add(p));
     FlightsViewModel.GetTrips().ForEach(f => Trips.Add(f));
 }
コード例 #5
0
        // GET: Flights

        public ActionResult Index(string id)
        {
            City             c   = new City(id);
            FlightsViewModel fvm = new FlightsViewModel(c);

            return(View(fvm));
        }
コード例 #6
0
        public async Task LoadData()
        {
            if (Flights == null)
            {
                Flights = new ObservableCollection <FlightsViewModel>();
                var flights = await DataManager.Flights.GetFlights();

                // Mappings
                foreach (var item in flights)
                {
                    FlightsViewModel flightsViewModel = new FlightsViewModel()
                    {
                        Airline                  = item.Airline,
                        FlightNumber             = item.FlightNumber,
                        GateNumber               = item.GateNumber,
                        DepartureAirport         = item.DepartureAirport,
                        DepartureAirportFullName = item.DepartureAirportFullName,
                        ArrivalAirport           = item.ArrivalAirport,
                        ArrivalAirportFullName   = item.ArrivalAirportFullName,
                        Date          = item.Date,
                        BoardingClass = item.BoardingClass,
                        ExtraData     = item.ExtraData,
                        PassengerName = item.PassengerName,
                        Status        = item.Status
                    };
                    Flights.Add(flightsViewModel);
                }
                if (!UnitTestingManager.IsRunningFromNUnit)
                {
                    await NavigationService.HideLoadingIndicator();
                }
            }
        }
コード例 #7
0
        public IActionResult Creer(FlightsViewModel entityViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(_flightLogic.FillLists(entityViewModel)));
            }

            try
            {
                if (!_flightLogic.TryReserveAircraft(entityViewModel, entityViewModel.AircraftGuid))
                {
                    ModelState.AddModelError(string.Empty, "Cet avion est déjà réservé dans cette plage horaire");
                    return(View(_flightLogic.FillLists(entityViewModel)));
                }

                Flight entity = entityViewModel;
                entity = _flightLogic.SetPeople(entity, entityViewModel, entityViewModel.AircraftGuid);
                _context.Flights.Add(entity);
                _context.SaveChanges();
            }
            catch (Exception ex)
            {
                ModelState.AddModelError(string.Empty, ex.Message);
                return(View(_flightLogic.FillLists(entityViewModel)));
            }

            return(RedirectToAction(nameof(Index)));
        }
コード例 #8
0
 public ActionResult Search(FlightsViewModel flightsViewModel)
 {
     flightsViewModel.Cities  = _cityRepository.Cities;
     flightsViewModel.Flights = _flightRepository.Flights;
     if (!flightsViewModel.FlightName.IsNullOrEmpty())
     {
         flightsViewModel.Flights =
             flightsViewModel.Flights.Where(f => f.FlightNumber.ToLower().Contains(flightsViewModel.FlightName.ToLower()));
     }
     if (flightsViewModel.CityTo != null)
     {
         flightsViewModel.Flights =
             flightsViewModel.Flights.Where(f => f.FlightToCity.CityId.Equals(flightsViewModel.CityTo));
     }
     if (flightsViewModel.CityFrom != null)
     {
         flightsViewModel.Flights =
             flightsViewModel.Flights.Where(f => f.FlightFromCity.CityId.Equals(flightsViewModel.CityFrom));
     }
     if (flightsViewModel.Date != null)
     {
         flightsViewModel.Flights = flightsViewModel.Flights.Where(f =>
                                                                   f.FlightDate.Date.Equals(flightsViewModel.Date.Value.Date));
     }
     return(View("Index", flightsViewModel));
 }
コード例 #9
0
        public void AddingTwiceTheSamePersonToAFlight_MustReturnAnError()
        {
            // Transaction pour rollback
            var transaction = _context.Database.BeginTransaction();

            // Création d'un compte
            Person person_1 = CreatePerson("test", "test", "*****@*****.**");

            // Capacité maximale à 5 personne
            Aircraft aircraft  = new Aircraft("test", 500, 35, 100, new TimeSpan(2, 0, 0), 5);
            Airport  airport_1 = new Airport("test", "France", 1.0, 1.0);
            Airport  airport_2 = new Airport("test_2", "France", 2.0, 2.0);

            Flight flight = new Flight(airport_1, airport_2);

            // On contourne la réservation de l'avion pour ce test
            flight.Aircraft = aircraft;

            // Ajout des entités au contexte
            _context.Aircrafts.Add(aircraft);
            _context.Airports.Add(airport_1);
            _context.Airports.Add(airport_2);
            _context.SaveChanges();

            // Ajout des deux personnes à la vue
            FlightsViewModel flightsViewModel = flight;

            flightsViewModel.PeopleIds.Add(person_1.Id);
            flightsViewModel.PeopleIds.Add(person_1.Id);

            flight = _flightsLogic.SetPeople(flight, flightsViewModel, aircraft.Id);
            Assert.Throws <InvalidOperationException>(() => _context.Flights.Add(flight));
        }
コード例 #10
0
 private void Save()
 {
     if (CheckDepAndArrCities())
     {
         FlightsViewModel.NewTrip.Clear();
         if (ReturnFlight)
         {
             FlightsViewModel.NewTrip.Add(new TripModel(ThereTripNo, null, AirwayCompany, Plane, DepCity, ArrCity, ThereFlightDepTime, ThereArrTime, "departure", null)
             {
                 ReturnTripBool = true, ReturnTripN = BackTripNo
             });
             FlightsViewModel.NewTrip.Add(new TripModel(BackTripNo, null, AirwayCompany, Plane, ArrCity, DepCity, BackFlightDepTime, BackArrTime, "arrival", null)
             {
                 ReturnTripBool = true, ReturnTripN = ThereTripNo
             });
         }
         else
         {
             FlightsViewModel.NewTrip.Add(new TripModel(ThereTripNo, null, AirwayCompany, Plane, DepCity, ArrCity, ThereFlightDepTime, ThereArrTime, "departure", null)
             {
                 ReturnTripBool = false
             });
         }
         foreach (var t in FlightsViewModel.NewTrip)
         {
             FlightsViewModel.SaveNewTrip(t);
         }
     }
 }
コード例 #11
0
        public void Loads_selected_airport_if_saved_to_disk()
        {
            _objectStore.Save(_lakselvAirport, Airport.SelectedAirportFilename);

            _viewModel = new FlightsViewModel(_flightsService, _objectStore, _messenger, _dispatcher);

            Assert.AreEqual(_lakselvAirport.Code, _viewModel.SelectedAirport.Code);
        }
コード例 #12
0
 private void Save()
 {
     if (CheckDepAndArrCities())
     {
         FlightsViewModel.ChangedTrip = new TripModel(Trip.TripNumber, null, AirwayCompany, Plane, DepCity, ArrCity, DepTime, ArrTime, null, null);
         FlightsViewModel.SaveChangedTrip(FlightsViewModel.ChangedTrip);
     }
 }
コード例 #13
0
 public void Setup()
 {
     lakselvAirport   = new Airport("LKL", "Lakselv");
     trondheimAirport = new Airport("TRD", "Trondheim");
     flightsService   = new FlightsServiceStub();
     objectStore      = new ObjectStoreStub();
     viewModel        = new FlightsViewModel(flightsService, objectStore);
 }
コード例 #14
0
        public void Loads_selected_airport_if_saved_to_disk()
        {
            objectStore.Save(lakselvAirport, ObjectStore.SelectedAirportFilename);

            viewModel = new FlightsViewModel(flightsService, objectStore);

            Assert.AreEqual(lakselvAirport.Code, viewModel.SelectedAirport.Code);
        }
コード例 #15
0
        public FlightsPage()
        {
            this.InitializeComponent();

            Flights = new List <Flight>(FlightsViewModel.GetFlights());

            FlightsListView.ItemsSource = Flights;
        }
コード例 #16
0
ファイル: HomeController.cs プロジェクト: yong-12/flight
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public IActionResult Index()
        {
            var mv = new FlightsViewModel()
            {
                Flights = _flightRepository.Flights.OrderBy(f => f.FlightId)
            };

            return(View(mv));
        }
コード例 #17
0
        public ActionResult Index()
        {
            FlightsViewModel flightsViewModel = new FlightsViewModel();

            flightsViewModel.Flights = _flightRepository.Flights;
            flightsViewModel.Cities  = _cityRepository.Cities;
            flightsViewModel.Date    = null;
            return(View(flightsViewModel));
        }
コード例 #18
0
        public ActionResult Index()
        {
            var model = new FlightsViewModel
            {
                FilterText = ""
            };

            return(View(model));
        }
コード例 #19
0
 private void DeleteTrip()
 {
     if (SelectedTrip != null)
     {
         List <TripModel> flights       = new List <TripModel>(FlightsViewModel.GetFlightsByTripNumber(SelectedTrip.TripNumber));
         List <TripModel> returnFlights = new List <TripModel>();
         if (SelectedTrip.ReturnTripBool)
         {
             returnFlights = FlightsViewModel.GetFlightsByTripNumber(SelectedTrip.ReturnTripN);
         }
         if (flights.Count > 0)
         {
             StringBuilder st = new StringBuilder();
             flights.ForEach(f => { st.Append(" " + f.Date); });
             string message;
             if (flights.Count == 1)
             {
                 message = "This trip can not be deleted because there is " + flights.Count + " flight in the schedule based on this trip with dates:" + st.ToString() + "." + " You should remove all flights based on this trip.";
             }
             else
             {
                 message = "This trip can not be deleted because there are " + flights.Count + " flights in the schedule based on this trip with dates:" + st.ToString() + "." + " You should remove all flights based on this trip.";
             }
             MessageBox.Show(message, "Delete trip", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
         else
         {
             string       message = "Delete trip " + SelectedTrip.TripNumber + " " + SelectedTrip.TownFrom + " - " + SelectedTrip.TownTo + " by " + SelectedTrip.AirwayCompany + " " + SelectedTrip.DepTime.ToShortTimeString() + " - " + SelectedTrip.ArrTime.ToShortTimeString() + " on " + SelectedTrip.Plane + "?";
             DialogResult result  = System.Windows.Forms.MessageBox.Show(message, "Delete trip", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             if (SelectedTrip.ReturnTripBool)
             {
                 string       message1 = "Trip " + SelectedTrip.TripNumber + " " + SelectedTrip.TownFrom + " - " + SelectedTrip.TownTo + " has return trip number " + SelectedTrip.ReturnTripN + ". Delete return trip as well?";
                 DialogResult result1  = MessageBox.Show(message1, "Delete return trip", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                 if (result1 == DialogResult.Yes)
                 {
                     if (returnFlights.Count > 0)
                     {
                         StringBuilder st = new StringBuilder();
                         returnFlights.ForEach(f => { st.Append(" " + f.Date); });
                         string message2 = "This trip can not be deleted because there are " + returnFlights.Count + " flights in the schedule based on this trip with dates:" + st.ToString() + "." + " You should remove all flights based on this trip.";
                         MessageBox.Show(message2, "Delete return trip", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                     }
                     else
                     {
                         FlightsViewModel.DeleteTrip(SelectedTrip.ReturnTrip); Trips.Remove(SelectedTrip.ReturnTrip);
                     }
                 }
             }
             if (result == DialogResult.Yes)
             {
                 FlightsViewModel.DeleteTrip(SelectedTrip);
                 Trips.Remove(SelectedTrip);
             }
         }
     }
 }
コード例 #20
0
 public void Setup()
 {
     _lakselvAirport   = new Airport("LKL", "Lakselv");
     _trondheimAirport = new Airport("TRD", "Trondheim");
     _flightsService   = new FlightsServiceStub();
     _objectStore      = new ObjectStoreStub();
     _messenger        = new TinyMessengerHub();
     _dispatcher       = new DispatchAdapter();
     _viewModel        = new FlightsViewModel(_flightsService, _objectStore, _messenger, _dispatcher);
 }
コード例 #21
0
        public ArrivalsDataSource(FlightsViewModel viewModel)
        {
            _viewModel = viewModel;

            _viewModel.Arrivals.CollectionChanged += (o, e) => {
                if (TableView != null)
                {
                    TableView.ReloadData();
                }
            };
        }
コード例 #22
0
        public void Finds_nearest_airport_if_option_is_selected()
        {
            objectStore.Save(Airport.Nearest, ObjectStore.SelectedAirportFilename);

            bool findNearestWasPublished = false;

            Messenger.Default.Register(this, (FindNearestAirportMessage m) => findNearestWasPublished = true);

            viewModel = new FlightsViewModel(flightsService, objectStore);

            Assert.IsTrue(findNearestWasPublished);
        }
コード例 #23
0
        public void Finds_nearest_airport_if_option_is_selected()
        {
            _objectStore.Save(Airport.Nearest, Airport.SelectedAirportFilename);

            bool findNearestWasPublished = false;

            _messenger.Subscribe <FindNearestAirportMessage>(m => findNearestWasPublished = true);

            _viewModel = new FlightsViewModel(_flightsService, _objectStore, _messenger, _dispatcher);

            Assert.IsTrue(findNearestWasPublished);
        }
コード例 #24
0
        // GET: Flights/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Flight flight = db.Flights.Find(id);

            if (flight == null)
            {
                return(HttpNotFound());
            }

            var Results = from f in db.Tourists
                          select new
            {
                f.Id,
                f.FirstName,
                f.LastName,
                Checked = ((from tf in db.TouristsToFlights
                            where (tf.FlightId == id) & (tf.TouristId == f.Id)
                            select tf).Count() > 0)
            };
            var MyViewModel = new FlightsViewModel();

            MyViewModel.FlightId           = id.Value;
            MyViewModel.Name               = flight.Name;
            MyViewModel.ArrivalDate        = flight.ArrivalDate;
            MyViewModel.DepartureDate      = flight.DepartureDate;
            MyViewModel.NumberOfSeats      = flight.NumberOfSeats;
            MyViewModel.NumberOfSeatsTaken = flight.NumberOfSeatsTaken;
            MyViewModel.Price              = flight.Price;
            var MyCheckBoxList = new List <CheckBoxViewModel>();

            foreach (var item in Results)
            {
                MyCheckBoxList.Add(new CheckBoxViewModel
                {
                    Id      = item.Id,
                    Name    = item.FirstName + " " + item.LastName,
                    Checked = item.Checked
                });
            }

            MyViewModel.Tourists = MyCheckBoxList;



            return(View(MyViewModel));
        }
コード例 #25
0
        public Flight SetPeople(Flight flight, FlightsViewModel flightsViewModel, Guid aircraftGuid)
        {
            flight.Aircraft = _context.Aircrafts.FirstOrDefault(s => s.Id == aircraftGuid);
            if (flightsViewModel.PeopleIds != null)
            {
                flightsViewModel.PeopleIds.ForEach(s => {
                    if (!flight.AddPerson(s))
                    {
                        throw new Exception("Limit excedeed !");
                    }
                });
            }

            return(flight);
        }
コード例 #26
0
        public void FillList_MustReturnCorrectData()
        {
            // Transaction pour rollback
            var transaction = _context.Database.BeginTransaction();

            // Création de comptes
            Person person_1 = CreatePerson("test", "test", "*****@*****.**");
            Person person_2 = CreatePerson("test", "test", "*****@*****.**");

            Aircraft aircraft = new Aircraft("test", 500, 35, 100, new TimeSpan(2, 0, 0), 5);
            Airport  airport  = new Airport("test", "France", 1.0, 1.0);

            FlightsViewModel flightsViewModel = new FlightsViewModel();

            flightsViewModel.FlightPersons = new List <FlightPerson>();
            flightsViewModel.FlightPersons.Add(new FlightPerson(flightsViewModel.Id, person_1.Id));
            flightsViewModel.FlightPersons.Add(new FlightPerson(flightsViewModel.Id, person_2.Id));

            // Ajout des entités au contexte
            _context.Users.Add(person_1);
            _context.Users.Add(person_2);
            _context.Aircrafts.Add(aircraft);
            _context.Airports.Add(airport);
            _context.SaveChanges();

            flightsViewModel = _flightsLogic.FillLists(flightsViewModel);

            // Contient les deux personnes dans la liste où les personnes sont inclues
            Assert.Contains(person_1.Id, flightsViewModel.IncludedPeople.Select(s => s.Value));
            Assert.Contains(person_2.Id, flightsViewModel.IncludedPeople.Select(s => s.Value));

            // Ne contient pas les deux personnes dans la liste exclue
            Assert.DoesNotContain(person_1.Id, flightsViewModel.ExcludedPeople.Select(s => s.Value));
            Assert.DoesNotContain(person_2.Id, flightsViewModel.ExcludedPeople.Select(s => s.Value));

            // Contient l'aéroport
            Assert.Contains(airport.Id.ToString(), flightsViewModel.AirportsList.Select(s => s.Value));

            // Contient l'avion
            Assert.Contains(aircraft.Id.ToString(), flightsViewModel.AircraftList.Select(s => s.Value));

            // Contient les Ids des personnes
            Assert.Contains(person_1.Id, flightsViewModel.PeopleIds);
            Assert.Contains(person_2.Id, flightsViewModel.PeopleIds);
        }
コード例 #27
0
        private void CreateNewTrip()
        {
            List <TripModel> newTrip = FlightsViewModel.CreateNewTrip();

            if (newTrip != null)
            {
                if (newTrip.Count == 1)
                {
                    Trips.Add(newTrip[0]);
                    SelectedTrip = Trips.Last();
                }
                else if (newTrip.Count == 2)
                {
                    newTrip.ForEach(t => Trips.Add(t));
                    SelectedTrip = Trips[Trips.IndexOf(Trips.Last()) - 1];
                }
            }
        }
コード例 #28
0
        public IActionResult Flights()
        {
            string           QRFID      = Request.Query["QRFId"].ToString();
            string           SaveType   = Convert.ToString(Request.Query["SaveType"]);
            string           PositionId = Request.Query["PositionId"];
            bool             IsClone    = Convert.ToBoolean(Request.Query["IsClone"]);
            FlightsViewModel model      = new FlightsViewModel();

            try
            {
                List <ProductType> lst = new List <ProductType>();
                lst.Add(new ProductType {
                    ProdType = "Domestic Flight"
                });
                PositionGetReq objPositionGetReq = new PositionGetReq()
                {
                    QRFID = QRFID, ProductType = lst, PositionId = PositionId, IsClone = IsClone
                };

                model = positionMapping.GetFlightsDetails(_configuration, token, objPositionGetReq);
                model.MenuViewModel.PositionId = PositionId;
                if (string.IsNullOrEmpty(PositionId))
                {
                    if (!string.IsNullOrEmpty(SaveType) && SaveType.ToLower() == "full")
                    {
                        model.SaveType = "success";
                        return(PartialView("_Flights", model));
                    }
                    else
                    {
                        return(View(model));
                    }
                }
                else
                {
                    return(PartialView("_Flights", model));
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(View(model));
        }
コード例 #29
0
        public IActionResult Modifier(FlightsViewModel entityViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(_flightLogic.FillLists(entityViewModel)));
            }

            try
            {
                // Récupération de l'entité pour comparer le RowVersion
                var originalEntity = _context.Flights.AsNoTracking().FirstOrDefault(s => s.Id == entityViewModel.Id);
                if (originalEntity == null)
                {
                    return(NotFound());
                }

                if (!originalEntity.RowVersion.Equals(entityViewModel.RowVersion))
                {
                    ModelState.AddModelError(string.Empty, "Veuillez rafraîchir la page car des entrées on été modifiées depuis votre dernière consultation !");
                    return(View(_flightLogic.FillLists(entityViewModel)));
                }

                if (!_flightLogic.TryReserveAircraft(entityViewModel, entityViewModel.AircraftGuid))
                {
                    ModelState.AddModelError(string.Empty, "Cet avion est déjà réservé dans cette plage horaire");
                    return(View(_flightLogic.FillLists(entityViewModel)));
                }

                Flight entity = entityViewModel;
                entity = _flightLogic.SetPeople(entity, entityViewModel, entityViewModel.AircraftGuid);
                entity = (Flight)entity.Update(originalEntity);
                _context.Entry(entity).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
                _context.Flights.Update(entity);
                _context.SaveChanges();
            }
            catch (Exception ex)
            {
                ModelState.AddModelError(string.Empty, ex.Message);
                return(View(_flightLogic.FillLists(entityViewModel)));
            }

            return(RedirectToAction(nameof(Index)));
        }
コード例 #30
0
        public ActionResult ShowFlights(string sortOrder, FlightSearchModel filter = null, string query = null)
        {
            ViewBag.NameSortParm   = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewBag.DateSortParm   = sortOrder == "Date" ? "date_desc" : "Date";
            ViewBag.StatusSortParm = sortOrder == "Status" ? "status_desc" : "Status";

            var viewModel = new FlightsViewModel
            {
                Heading  = "All flights",
                Airports = _service.GetAllAirports(),
                Statuses = _service.GetAllStatuses(),
                Flights  = _service.SortFlight(_service.GetFilteredFlights(query, filter), sortOrder)
            };

            if (User.IsInRole(RoleName.Admin))
            {
                return(View("FlightsList", viewModel));
            }
            return(View("ReadOnlyFlightsList", viewModel));
        }