示例#1
0
        public Flight CreateFlightForTest()
        {
            AirlineCompany airline = airlineCompanyDAOPGSQL.GetAirlineByUserame(TestData.CreateAirlineUser_Username);

            TestData.CreateAirlineCompany_Id = airline.Id;

            Flight flight = new Flight
            {
                Airline_Company_Id     = TestData.CreateAirlineCompany_Id,
                Origin_Country_Id      = TestData.CreateFlight_OriginCountryId,
                Destination_Country_Id = TestData.CreateFlight_DestinationCountryId,
                Departure_Time         = TestData.CreateFlight_DepartureTime,
                Landing_Time           = TestData.CreateFlight_LandingTime,
                Tickets_Remaining      = TestData.CreateFlight_TicketsRemaining
            };

            return(flight);
        }
示例#2
0
        public bool TryAirlineLogin(string username, string password, out LoginToken <AirlineCompany> token)
        {
            AirlineCompany company = _airlineCompanyDAO.GetAirlineByUserame(username);

            if (company != null)
            {
                if (company.Password == password)
                {
                    token = new LoginToken <AirlineCompany>()
                    {
                        User = company
                    };
                    return(true);
                }
                throw new WrongCredentialsException();
                // wrong passowrd exception
                // catch
            }
            token = null;
            return(false);
        }