public Trip FindTripByOrderId(int orderId) { Order order = OrderDAO.GetOrderById(orderId); Trip trip = TripDAO.Read().First(t => t.OrderId == orderId); Car car = CarDAO.GetById(trip.CarId); Account account = AccountDAO.GetAccountById(trip.AccountId); trip.Order = order; trip.Account = account; trip.Car = car; return(trip); }
public List <Trip> FindTripsRelatedTo(string currentUser) { List <Trip> relatedTrips = new List <Trip>(); if (currentUser != null && currentUser != string.Empty) { relatedTrips = TripDAO.Read() .Where(trip => trip.AccountId == Convert.ToInt32(currentUser) && TripStatusEnum.IN_PROCESS.Equals(OrderDAO.GetOrderById(trip.OrderId).Status)) .ToList(); } return(relatedTrips); }