public CustomerContractsModel GetById(long customerId)
        {
            CustomerModel customer;

            using (_context)
            {
                customer = _context.Customer.FirstOrDefault(x => x.Id == customerId);
            }

            return(customer == null ? null : ModelConverterHelper.GetContractModel(customer));
        }
        public GateContractsModel GetById(long gateId)
        {
            if (gateId <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(gateId));
            }

            using (_context)
            {
                this._gate = this._context.Gate.FirstOrDefault(x => x.Id == gateId);
            }

            return(this._gate == null ? null : ModelConverterHelper.GetContractModel(this._gate));
        }
        public List <CustomerContractsModel> GetAllCustomers()
        {
            List <CustomerContractsModel> customerList = new List <CustomerContractsModel>();

            using (_context)
            {
                var customers = _context.Customer.ToList();

                foreach (var customer in customers)
                {
                    customerList.Add(ModelConverterHelper.GetContractModel(customer));
                }
            }

            return(customerList);
        }
        public List <FlightContractsModel> GetAllFlights()
        {
            List <FlightContractsModel> flightContracts = new List <FlightContractsModel>();

            using (_context)
            {
                IEnumerable <FlightModel> flights = _context.Flight.ToList();

                foreach (var flightModel in flights)
                {
                    flightContracts.Add(ModelConverterHelper.GetContractModel(flightModel));
                }
            }

            return(flightContracts);
        }
        public List <GateContractsModel> GetAllGates()
        {
            List <GateContractsModel> gates = new List <GateContractsModel>();

            using (_context)
            {
                List <GateModel> gateModels = this._context.Gate.ToList();

                foreach (GateModel model in gateModels)
                {
                    gates.Add(ModelConverterHelper.GetContractModel(model));
                }
            }

            return(gates);
        }
        public FlightContractsModel GetFlightById(long flightId)
        {
            if (flightId <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(flightId));
            }

            using (_context)
            {
                this._flight = this._context.Flight.FirstOrDefault(x => x.Id == flightId);

                if (this._flight == null)
                {
                    return(null);
                }
            }

            return(ModelConverterHelper.GetContractModel(this._flight));
        }