public static IQueryable <Book> RateBooks(User user, BookRateEnum bookrate) { int rate = BookHelper.BookRateConvert(bookrate); var bs = from ub in JianLiLinq.Default.DB.UserBooks where ub.BookRate == rate && ub.UserID == user.UserID select ub.Book; return(bs.Take(8)); }
public static IQueryable <Book> TypeBooks(BookTypeEnum booktype) { int?type = BookHelper.BookTypeConvert(booktype); if (type == null) { var bs = from book in JianLiLinq.Default.DB.Books where book.BookType == null select book; return(bs); } else { var bs = from book in JianLiLinq.Default.DB.Books where book.BookType == type select book; return(bs); } }