public AiBookModelListView PrepareBookNodeListModel(AiBookSearchModelView searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } var result = _aiBookService.SearchAiBookModels(searchModel.BookAiModelName, searchModel.Page - 1, searchModel.PageSize, new List <int> { searchModel.CateId }, searchModel.BookId, searchModel.BookDirId, 0); var model = new AiBookModelListView().PrepareToGrid(searchModel, result, () => { return(result.Select(category => { //fill in model values from the entity var categoryModel = category.ToModel <AiBookModelView>(); //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); // _baseAdminModelFactory.PrepareCategories(searchModel.AvailableCategories, // defaultItemText: _localizationService.GetResource("Admin.Catalog.Categories.Fields.Parent.None")); //if (searchModel.BookId > 0) //{ // var result = _productService.GetProductById(searchModel.BookId); // if (result != null) // { // if (result.ProductCategories != null) // { // searchModel.CateId = result.ProductCategories.FirstOrDefault().CategoryId; // } // searchModel.BookId = result.Id; // searchModel.AvailableBooks = SelectListHelper.GetBookList(_productService, new List<int> { searchModel.CateId }); // } //} //if (searchModel.BookDirId > 0) //{ // searchModel.AvailableBookDirs = SelectListHelper.GetBookDirList(_bookdirService); //} //return searchModel; // throw new NotImplementedException(); }