コード例 #1
0
        public ActionResult ViewTrip(int tripId)
        {
            ViewTripModel trips = new ViewTripModel();

            TripDetaisTable trip = context.TripDetaisTables.Where(x => x.TripID == tripId).SingleOrDefault();

            trips.tripId    = trip.TripID;
            trips.CarAmount = trip.CarPerDay;
            trips.VanAmount = trip.VanPerDay;
            trips.BusAmount = trip.BusPerDay;

            return(View(trips));
        }
コード例 #2
0
        public ActionResult ViewTrip(int id)
        {
            using (context)
            {
                TripViewModelAdmin model      = new TripViewModelAdmin();
                TripsTable         trip       = context.TripsTables.Where(x => x.TripID == id).FirstOrDefault();
                RiderDetailsTable  rider      = context.RiderDetailsTables.Where(x => x.RiderID == trip.UserID).FirstOrDefault();
                TripDetaisTable    tripDetail = context.TripDetaisTables.Where(x => x.TripID == trip.TripDetailsTableID).FirstOrDefault();
                if (trip.DriverID != null)
                {
                    DriverDetailsTable driver = context.DriverDetailsTables.Where(x => x.DriverID == trip.DriverID).FirstOrDefault();
                    model.Driver = driver;
                }
                model.Trips       = trip;
                model.Rider       = rider;
                model.TripDetails = tripDetail;

                return(PartialView("ViewTripPV", model));
            }
        }
コード例 #3
0
        public JsonResult CalAmount(int days, int tripId)
        {
            ViewTripModel   trips = new ViewTripModel();
            TripDetaisTable trip  = context.TripDetaisTables.Where(x => x.TripID == tripId).SingleOrDefault();

            trips.tripId = trip.TripID;
            switch (days)
            {
            case 1:
                trips.CarAmount = trip.CarPerDay;
                trips.VanAmount = trip.VanPerDay;
                trips.BusAmount = trip.BusPerDay;
                break;

            case 2:
                trips.CarAmount = (trip.CarPerDay * days) - 500;
                trips.VanAmount = (trip.VanPerDay * days) - 1000;
                trips.BusAmount = (trip.BusPerDay * days) - 2000;
                break;

            case 3:
                trips.CarAmount = trip.CarPerDay * days - 1000;
                trips.VanAmount = trip.VanPerDay * days - 2000;
                trips.BusAmount = trip.BusPerDay * days - 3000;
                break;

            case 4:
                trips.CarAmount = trip.CarPerDay * days - 1500;
                trips.VanAmount = trip.VanPerDay * days - 3000;
                trips.BusAmount = trip.BusPerDay * days - 4000;
                break;

            case 5:
                trips.CarAmount = trip.CarPerDay * days - 2000;
                trips.VanAmount = trip.VanPerDay * days - 4000;
                trips.BusAmount = trip.BusPerDay * days - 5000;
                break;
            }

            return(Json(trips, JsonRequestBehavior.AllowGet));
        }