Esempio n. 1
0
 public List<Trip> GetTripsByUser(User user)
 {
     var tripList = new List<Trip>();
     var loggedUser = UserSession.GetInstance().GetLoggedInUser();
     var isFriend = false;
     if (loggedUser != null) {
         foreach(var friend in user.GetFriends()) {
             if (friend.Equals(loggedUser)) {
                 isFriend = true;
                 break;
             }
         }
         if (isFriend) {
             tripList = TripDAO.FindTripsByUser(user);
         }
         return tripList;
     } else {
         throw new UserNotLoggedInException();
     }
 }
Esempio n. 2
0
 public static List<Trip> FindTripsByUser(User user)
 {
     throw new CollaboratorCallException(
         "TripDAO should not be invoked on an unit test.");
 }
Esempio n. 3
0
 public void AddFriend(User user)
 {
     _friends.Add(user);
 }