public Boolean Add(int bookid) { try { IBookService bookService = new BookService(); Book book = bookService.GetById(bookid); var bookRequest = new BookRequest(); bookRequest.Book = book; IList<BookRequest> bookRequestList = new List<BookRequest>(); bookRequestList.Add(bookRequest); IBookRequestDal bookRequestDal = new BookRequestDal(); Boolean status = bookRequestDal.Add(bookRequestList); return status; } catch (Exception e) { Console.WriteLine("Error in BookRequestService, Add()"); Console.Write(e.ToString()); return false; } }
public BookRequest GetByBook(int bookid) { try { IBookDal bookDal = new BookDal(); Book book = bookDal.GetById(bookid); IBookRequestDal bookRequestDal = new BookRequestDal(); BookRequest bookRequest = bookRequestDal.GetByBook(book); return bookRequest; } catch (Exception e) { Console.WriteLine("Error in BookRequestService , GetBookById()"); Console.Write(e.ToString()); return null; } }