コード例 #1
0
        // GET: VehicleModels
        public ActionResult Index(string sortBy, int?filter, int?page)
        {
            // Get vehicle makes
            IEnumerable <VehicleModel> vehicleModels = vehicleModelLogic.GetVehicleModels(filter, page, sortBy);

            // Put data in ViewBag
            ViewBag.sortBy = sortBy;
            ViewBag.filter = filter;
            ViewBag.Makes  = new SelectList(vehicleMakeLogic.GetVehicleMakes(), "Id", "Name");

            IEnumerable <VehicleModelViewModel> vehicleModelsVM =
                Mapper.Map <IEnumerable <VehicleModelViewModel> >(vehicleModels);

            return(View("~/Views/Admin/VehicleModels/Index.cshtml", vehicleModelsVM));
        }
コード例 #2
0
        // GET: VehicleMakes
        public ActionResult Index(string sortBy, int?page, string filter = "")
        {
            // Get vehicle makes
            IPagedList vehicleMakes = vehicleMakeLogic.GetVehicleMakes(page, filter, sortBy);

            // Put data in view bag
            ViewBag.sortBy = sortBy;
            ViewBag.filter = filter;

            // Map to Vehicle Make View Model
            IPagedList <VehicleMakeViewModel> vehicleMakesVM =
                Mapper.Map <IPagedList <VehicleMakeViewModel> >(vehicleMakes);

            //IPagedList vehicleMakesVM = Mapper.Map<IPagedList<VehicleMakeViewModel>>(vehicleMakes);


            return(View("~/Views/Admin/VehicleMakes/Index.cshtml", vehicleMakesVM));
        }