Exemplo n.º 1
0
        private IEnumerable <SelectListItem> GetPreDefined(string type)
        {
            List <PreDefineTrip>         vehicle = _preDefineTripService.GetAllPreDefineTrip().Where(a => a.TripType.Equals(type)).ToList();
            IEnumerable <SelectListItem> vehi    = vehicle.Select(x => new SelectListItem
            {
                Value = x.PreDefineTripId.ToString(),
                Text  = x.PreDefineTripName.ToString()
            });

            return(new SelectList(vehi, "Value", "Text"));
        }
        // GET: ManageTrips
        public ActionResult Index(string message, int?items)
        {
            if (message != null)
            {
                if (message.Equals("Success"))
                {
                    ModelState.AddModelError("", "Successfully deleted " + items + " item(s)");
                }
                else
                {
                    ModelState.AddModelError("", "Please select package(s) or rate(s) to delete");
                }
            }
            TripPackageViewModel model = new TripPackageViewModel();
            IEnumerable <Domain.Trips.PreDefineTrip> preDefineTrips = _preDefineTripService.GetAllPreDefineTrip();
            IEnumerable <Domain.Trips.VehicleRate>   vahicleRates   = _vehicleRateService.GetAllVehicleRates();

            model.Packages     = Mapper.Map <IEnumerable <PreDefineTripViewModel> >(preDefineTrips);
            model.FarePackages = Mapper.Map <IEnumerable <VehicleRateViewModel> >(vahicleRates);
            return(View(model));
        }