Exemplo 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();
     }
 }
Exemplo n.º 2
0
 public static List<Trip> FindTripsByUser(User user)
 {
     throw new CollaboratorCallException(
         "TripDAO should not be invoked on an unit test.");
 }
Exemplo n.º 3
0
 public void AddFriend(User user)
 {
     _friends.Add(user);
 }