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(); } }
protected virtual List <Trip> FindTripsByUser(User.User user) { return(TripDAO.FindTripsByUser(user)); }
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; }
public TripService(TripDAO tripDao) { _tripDAO = tripDao ?? throw new ArgumentNullException(nameof(tripDao)); }
public virtual List <Trip> FindTrips(User.User user) { return(TripDAO.FindTripsByUser(user)); }