public Trip GetTrip(DirectionsRouteModel directionsRoute) { DirectionsRouteModel driverRoute = this.Session[SessionKeys.ROUTE] as DirectionsRouteModel; this.Session[SessionKeys.ROUTE] = null; Trip trip = new Trip(); trip.AvailablePlacesCount = directionsRoute.Free; trip.CarId = 1; trip.CostOneSeat = directionsRoute.Price; trip.TripTime = driverRoute.Date; trip.Driver.Login = this.User.Identity.Name; trip.AdditionalInfo = directionsRoute.AdditionalInfo; Location[] locations = driverRoute.GetLocations(); for (int a = 0; a < locations.Length; a++) { trip.RouteLocations.Add(new LocationInfo(locations[a].Latitude, locations[a].Longitude)); } return trip; }
public void AddNew(Trip trip) { var tripId = this.AddTrip(trip); this.AddRoute(trip.RouteLocations, tripId); }
private int AddTrip(Trip trip) { return this._tripRepository.InsertTrip(trip); }