Beispiel #1
0
        protected override IQueryable <BookList> CreateFilteredQuery(BookListGetPagedInput input)
        {
            var query = _bookList.GetAll()
                        .WhereIf(!input.FilterText.IsNullOrWhiteSpace(), m => m.Name.Contains(input.FilterText))
                        .Include(m => m.Cells);

            return(query);
        }
Beispiel #2
0
        /// <summary>
        /// 获取引用书籍的所有书单
        /// </summary>
        /// <param name="bookId"></param>
        /// <returns></returns>
        public async Task <List <BookList> > GetBookListForBookAsync(long bookId)
        {
            // 书籍所在的格子
            var cells = await _bookListCell.GetForBookAsync(bookId);

            if (cells.Count > 0)
            {
                // 格子所在的书单
                var bookListIds = cells.Select(m => m.BookListId);

                return(await _bookList.GetAll().Where(m => bookListIds.Contains(m.Id)).ToListAsync());
            }

            return(null);
        }