Пример #1
0
 public static BookToList CastBookTableToBookLIST(BooksTable bookTable)
 {
     try
     {
         BookToList book = new BookToList()
         {
             numberOfViewers = bookTable.numberOfViewers,
             picNAme         = bookTable.picNAme,
             autherId        = LookupBL.getLookupByCode(Constants.AutherTableName, bookTable.autherId),
             //   categoryId = LookupBL.getLookupByCode(Constants.BooksCategoryTableName, bookTable.categoryId),
             id = bookTable.id,
             // description = bookTable.description,
             //  numOfPages = bookTable.numOfPages,
             isBorrowed = bookTable.isBorrowed,
             // lenderId = bookTable.lenderId,
             nameId = LookupBL.getLookupByCode(Constants.BooksNameTableName, bookTable.nameId),
             //  publishingId = LookupBL.getLookupByCode(Constants.PuplishingTableName, bookTable.publishingId)
         };
         return(book);
     }
     catch (Exception)
     {
         return(null);
     }
 }
Пример #2
0
        public static List <BookToList> Serch(string name, int?categoryIdSearch, string autherToSerch, string publishingToSerch, int?cityCode)
        {
            List <BooksTable> booksDB  = BooksData.Serch(name, categoryIdSearch, autherToSerch, publishingToSerch, cityCode);
            List <BookToList> resBooks = new List <BookToList>();

            foreach (var item in booksDB)
            {
                BookToList b = CastBookTableToBookLIST(item);
                if (b != null)
                {
                    resBooks.Add(b);
                }
            }
            return(resBooks);
        }
Пример #3
0
        public static List <BookToList> GetAllBook()
        {
            List <BooksTable> booksDB  = BooksData.getAllBooks();
            List <BookToList> resBooks = new List <BookToList>();

            foreach (var item in booksDB)
            {
                BookToList b = CastBookTableToBookLIST(item);
                if (b != null)
                {
                    resBooks.Add(b);
                }
            }
            return(resBooks);
        }