示例#1
0
        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;
        }
示例#2
0
 public void AddNew(Trip trip)
 {
     var tripId = this.AddTrip(trip);
     this.AddRoute(trip.RouteLocations, tripId);
 }
示例#3
0
 private int AddTrip(Trip trip)
 {
     return this._tripRepository.InsertTrip(trip);
 }