public async Task <RecordsViewModel <FlightReservationModel> > GetRecord(int pageIndex, int itemsPage, int?airplaneId, int?pilotId)
        {
            _logger.LogInformation("GetFlightRecord called");
            string idNumber = "", tailNumber = "";

            if (pilotId != null)
            {
                Pilot pilot = await _clubService.GetPilotById((int)pilotId);

                if (pilot != null)
                {
                    idNumber = pilot.IdNumber;
                }
            }
            if (airplaneId != null)
            {
                Aircraft ar = await _aircraftRepository.GetByIdAsync((int)airplaneId);

                if (ar != null)
                {
                    tailNumber = ar.TailNumber;
                }
            }
            ReservationSpecification flightPagingSpec = new ReservationSpecification(itemsPage * pageIndex, itemsPage, tailNumber, idNumber);
            ReservationSpecification flightSpec       = new ReservationSpecification(tailNumber, idNumber);

            var flightOnPage = await _reservationRepository.ListAsync(flightPagingSpec);

            var totalFlight = await _reservationRepository.CountAsync(flightSpec);

            var airplanes = await GetAirplans(1);

            airplanes.Add(new AirplaneSelectModel()
            {
                Id = 0, TailNumber = "Select All"
            });
            var vm = new RecordsViewModel <FlightReservationModel>()
            {
                Records = flightOnPage.Select(i => new FlightReservationModel()
                {
                    Id         = i.Id,
                    DateFrom   = i.DateFrom,
                    DateTo     = i.DateTo,
                    IdNumber   = i.IdNumber,
                    TailNumber = i.TailNumber,
                    UserInfo   = i.ReservationInfo
                }),
                FilterViewModel = new FilterModel()
                {
                    AirplaneSelects       = airplanes,
                    ClubSelects           = await GetClubs(1),
                    PilotSelects          = await GetPilots(1),
                    PilotFilterApplied    = pilotId,
                    ClubFilterApplied     = 1,
                    AirplaneFilterApplied = airplaneId,
                },
                PaginationInfo = new PaginationInfoModel()
                {
                    ActualPage   = pageIndex,
                    ItemsPerPage = flightOnPage.Count,
                    TotalItems   = totalFlight,
                    TotalPages   = int.Parse(Math.Ceiling((decimal)totalFlight / itemsPage).ToString())
                }
            };

            vm.PaginationInfo.Next     = (vm.PaginationInfo.ActualPage >= vm.PaginationInfo.TotalPages - 1) ? "disabled" : "";
            vm.PaginationInfo.Previous = (vm.PaginationInfo.ActualPage == 0) ? "disabled" : "";
            return(vm);
        }
        public async Task <IEnumerable <AircraftReservation> > GetPilotReservation(string idNumber)
        {
            ReservationSpecification reservationSpecification = new ReservationSpecification(0, 10, "", idNumber);

            return(await _reservationRepository.ListAsync(reservationSpecification));
        }