Example #1
0
        public ActionResult Index()
        {
            using (BookEntity BE = new BookEntity()) {
                SearchBooks bookList = new SearchBooks();
                bookList.BookList.AddRange(BE.Books);

                return(View(bookList));
            }
        }
Example #2
0
        public async Task <SearchBooks> Get(string name)
        {
            string key     = "AIzaSyCfjBhpALhE_f3OxvGoDVJrLAolPYQ1I8c";
            string url     = "https://www.googleapis.com/books/v1/volumes?q=" + name + "&langRestrict=en&filter=free-ebooks&maxResults=5&%20key=" + key;
            var    result1 = await GetAsync(url);

            string      m    = result1;
            SearchBooks obj1 = JsonConvert.DeserializeObject <SearchBooks>(m);

            return(obj1);
        }
Example #3
0
        public IHttpActionResult SearchBook(string searchquery)
        {
            IList <BookList> booklist = null;

            booklist = SearchBooks.GetBooklists(searchquery).ToList <BookList>();
            if (booklist.Count == 0)
            {
                return(NotFound());
            }
            return(Ok(booklist));
        }
Example #4
0
        public IHttpActionResult GetAllBooks()
        {
            IList <BookList> booklist = null;

            booklist = SearchBooks.GetBooklistAll().ToList <BookList>();

            if (booklist.Count == 0)
            {
                return(NotFound());
            }
            return(Ok(booklist));
        }
Example #5
0
        public ViewBookForm(FormClose hClose, ReturnToMenu hReturnToMenu, GenreRequest hGenreRequest, SearchBooks hSearchBooks)
        {
            handleClose        = hClose;
            handleReturnToMenu = hReturnToMenu;
            handleSearchBooks  = hSearchBooks;

            InitializeComponent();
            BackColor = Color.SteelBlue;
            uxQueryPanel.BackColor = Color.LightSteelBlue;
            genres = hGenreRequest();
            genres.ForEach(genre => uxGenreBox.Items.Add(genre));
        }
Example #6
0
        public ActionResult Index(SearchBooks searchBook)
        {
            using (BookEntity BE = new BookEntity()) {
                SearchBooks bookResults = new SearchBooks();

                bookResults.BookList.AddRange(BE.Books.Where(b =>
                                                             (b.Title.Trim().Contains(searchBook.Title.Trim() ?? " ")) &&
                                                             (b.Author.Trim().Contains(searchBook.Author.Trim() ?? " ")) &&
                                                             (b.BookSeries.Trim().Contains(searchBook.BookSeries.Trim()) ||
                                                              searchBook.BookSeries == null) &&
                                                             (b.Rating == searchBook.Rating || searchBook.Rating == null)
                                                             ).Take(10));

                return(View(bookResults));
            }
        }