Exemple #1
0
        public List <Trip> GetTripsByUser(User.User user)
        {
            List <Trip> tripList = new List <Trip>();

            User.User loggedUser = UserSession.GetInstance().getLoggedUser();
            bool      isFriend   = false;

            if (loggedUser != null)
            {
                foreach (User.User friend in user.GetFriends())
                {
                    if (friend.Equals(loggedUser))
                    {
                        isFriend = true;
                        break;
                    }
                }
                if (isFriend)
                {
                    tripList = TripDAO.FindTripsByUser(user);
                }
                return(tripList);
            }
            else
            {
                throw new UserNotLoggedInException();
            }
        }
Exemple #2
0
 protected virtual List <Trip> FindTripsByUser(User.User user)
 {
     return(TripDAO.FindTripsByUser(user));
 }
Exemple #3
0
 public List <Trip> FindTripsByUser(User.User user)
 {
     return(TripDAO.FindTripsByUser(user));
 }
 public TripService(UserSession userSession, TripDAO tripDao)
 {
     this.userSession = userSession;
     this.tripDao = tripDao;
 }
 public TripService(TripDAO tripDao)
 {
     _tripDao = tripDao;
 }
 public TripService(User.User loggedInUser, TripDAO tripDAO)
 {
     this.loggedInUser = loggedInUser;
     this.tripDAO      = tripDAO;
 }
Exemple #7
0
 public TripService(TripDAO tripDao)
 {
     _tripDAO = tripDao ?? throw new ArgumentNullException(nameof(tripDao));
 }
Exemple #8
0
 public virtual List <Trip> FindTrips(User.User user)
 {
     return(TripDAO.FindTripsByUser(user));
 }