Exemplo n.º 1
0
        public virtual CarListModel PrepareListModel(CarSearchModel searchModel)
        {
            if (null == searchModel)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            var list = carService.GetAll(
                pageIndex: searchModel.Page - 1,
                pageSize: searchModel.PageSize,
                license: searchModel.SearchLicense,
                enabled: searchModel.SearchEnabled);

            var model = new CarListModel
            {
                Data = list.Select(x =>
                {
                    var modelItem = x.ToModel <CarModel>();

                    return(modelItem);
                }),
                Total = list.TotalCount
            };

            return(model);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 汽车列表首页
        /// </summary>
        /// <returns>View</returns>
        public ActionResult Index()
        {
            var model = new CarListModel();

            model.SecondHandCars = carCache.GetCarSecondHandCarList();
            return(View(model));
        }