示例#1
0
 public static List<Book> getAll(string aId)
 {
     List<BookDTO> dtoList = null; ;
     // This method retrieves a list of all books in the library system
     if (string.IsNullOrEmpty(aId))
     {
         dtoList = LibraryDataAccess.getAllBooksDAL();  //BookDTO is the interface common for BL and DAL
     }
     else
     {
         //Fetch the correct AuthorDTO object and connect an Author object for it
         AuthorDTO dto = LibraryDataAccess.loadAuthorDAL(Convert.ToInt32(aId));
         dto.loadStatus = LoadStatus.Ghost; //Force it to load all data
         Author AuthorObject = new Author(dto);
         // Use the author objects IsbnList property 
         dtoList = LibraryDataAccess.getAllAuthorBookDAL(AuthorObject.IsbnList);
     }
     // Convert to Book objects since UI only references BL (not DAL or DTO)
     List<Book> results = new List<Book>();
     foreach (BookDTO dto in dtoList)
     {
         Book item = new Book(dto);
         results.Add(item);
     }
     return results;
 }
示例#2
0
        public static List<Author> getAll()
        {
            // This method retrieves a list of all authors in the library system
            List<AuthorDTO> dtoList = LibraryDataAccess.getAllAuthorsDAL();  //AuthorDTO is the interface common for BL and DAL

            // Convert to Author objects
            List<Author> results = new List<Author>();
            foreach(AuthorDTO dto in dtoList)
            {
                Author item = new Author(dto);
                results.Add(item);
            }
            return results;
        }