예제 #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();
            }
        }
예제 #2
0
 protected virtual List <Trip> FindTripsByUser(User.User user)
 {
     return(TripDAO.FindTripsByUser(user));
 }
예제 #3
0
 public List <Trip> FindTripsByUser(User.User user)
 {
     return(TripDAO.FindTripsByUser(user));
 }
예제 #4
0
 public TripService(UserSession userSession, TripDAO tripDao)
 {
     this.userSession = userSession;
     this.tripDao = tripDao;
 }
 public TripService(TripDAO tripDao)
 {
     _tripDao = tripDao;
 }
예제 #6
0
 public TripService(User.User loggedInUser, TripDAO tripDAO)
 {
     this.loggedInUser = loggedInUser;
     this.tripDAO      = tripDAO;
 }
예제 #7
0
 public TripService(TripDAO tripDao)
 {
     _tripDAO = tripDao ?? throw new ArgumentNullException(nameof(tripDao));
 }
예제 #8
0
 public virtual List <Trip> FindTrips(User.User user)
 {
     return(TripDAO.FindTripsByUser(user));
 }