internal static BookViewModel GetBook(int id) { Book b = DBHelper.GetBook(id); if (b == null) { return(null); } return(ModelConverter.BookToView(b)); }
public static Tuple <List <BookViewModel>, int> GetAllBooksView(int[] topicIds = null, int authorId = -1, int publisherId = -1, int page = 1, string search = "*") { var books = DBHelper.GetAllBooks(topicIds, authorId, publisherId, page, search); List <BookViewModel> result = new List <BookViewModel>(); foreach (var book in books.Item1) { result.Add(ModelConverter.BookToView(book)); } return(new Tuple <List <BookViewModel>, int>(result, books.Item2)); }
public static BookViewModel Get1Book(int id) { Book a = DBHelper.GetBook(id, null); return(ModelConverter.BookToView(a)); }
//public static List<BookViewModel> SearchBooks(string pattern) //{ // return GetAllBooksView().Where(x => x.Name.ToUpper().Contains(pattern.ToUpper())).ToList(); //} public static List <BookViewModel> GetLastestBooks(int number) { return(DBHelper.GetLastestBooks(number).Select(x => ModelConverter.BookToView(x)).ToList()); }