예제 #1
0
        public IActionResult GetList(BookDirSearchModel searchModel)
        {
            //prepare model
            var model = _bookDirFactory.PrepareBookDirListModel(searchModel);

            return(Json(model));
        }
예제 #2
0
        public BookDirListModel PrepareBookDirListModel(BookDirSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            var result = _bookDirService.GetAllBookDirsData(searchModel.SearchDirName, searchModel.CategoryID, searchModel.BookID, searchModel.BookDirId, searchModel.SearchStoreId, searchModel.Page - 1, searchModel.PageSize);


            var model = new BookDirListModel().PrepareToGrid(searchModel, result, () =>
            {
                return(result.Select(category =>
                {
                    //fill in model values from the entity
                    var categoryModel = category.ToModel <BookDirModel>();
                    //fill in additional values (not existing in the entity)
                    categoryModel.Breadcrumb = _bookDirService.GetFormattedBreadCrumb(category);
                    categoryModel.SeName = _urlRecordService.GetSeName(category, 0, true, false);
                    return categoryModel;
                }));
            });


            return(model);
        }
예제 #3
0
        public BookDirSearchModel PrepareBookDirSearchModel(BookDirSearchModel searchModel, BookDirModel bdm)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }
            searchModel.SearchDirName = bdm.Name;
            ///  searchModel.AvailableBooks =
            //prepare available stores
            _baseAdminModelFactory.PrepareStores(searchModel.AvailableStores);


            _baseAdminModelFactory.PrepareCategories(searchModel.AvailableCategories);

            //searchModel.AvailableBooks = _productService.ge


            //prepare page parameters
            searchModel.SetGridPageSize();
            return(searchModel);
        }
예제 #4
0
        /// <summary>
        /// 获取所属书籍
        /// </summary>
        /// <param name="searchModel"></param>
        /// <returns></returns>
        public IActionResult GetBooksByCategory(BookDirSearchModel searchModel)
        {
            var result = _productModelFactory.PrepareProductListModel(
                new Models.Catalog.ProductSearchModel()
            {
                SearchCategoryId = searchModel.CategoryID
            });

            return(Json(result.Data.ToList()));
        }
예제 #5
0
        public virtual IActionResult List(BookDirSearchModel searchModel)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageCategories))
            {
                return(AccessDeniedDataTablesJson());
            }

            //prepare model
            var model = _bookDirFactory.PrepareBookDirSearchModel(searchModel, new BookDirModel());

            return(Json(model));
        }
예제 #6
0
        public IActionResult GetBookDirByBookId(BookDirSearchModel searchModel)
        {
            var model = _bookDirFactory.PrepareBookDirListModel(searchModel);

            return(Json(model.Data.ToList()));
        }