Exemplo n.º 1
0
        public bool TryCustomerLogin(string userName, string password, out LoginToken <Customer> token)
        {
            Customer customer = _customerDAO.GetCustomerByUserame(userName);

            if (customer != null)
            {
                if (customer.UserName == userName)
                {
                    if (customer.Password == password)
                    {
                        token      = new LoginToken <Customer>();
                        token.User = customer;
                        return(true);
                    }
                    else
                    {
                        throw new WrongPasswordException("Wrong Password");
                    }
                }
            }
            token = null;
            return(false);
        }
Exemplo n.º 2
0
        public bool TryAirlineLogin(string userName, string password, out LoginToken <AirlineCompany> token)
        {
            AirlineCompany company = _airlineDAO.GetAirlineByUsername(userName);

            if (company != null)
            {
                if (company.UserName == userName)
                {
                    if (company.Password == password)
                    {
                        token      = new LoginToken <AirlineCompany>();
                        token.User = company;
                        return(true);
                    }
                    else
                    {
                        throw new WrongPasswordException("Wrong Password");
                    }
                }
            }
            token = null;
            return(false);
        }