package com.agiledeveloper

class SearchBookController {

  def index() {
    [title: '', booksList: []]
  }

  def books() {
    def title = ''
    def booksList = []
    
    if(params.title) {
      title = params.title
      
      booksList = Book.findAllByTitleLike("%$title%")
    }
    
    render template: 'bookslist', model: [title: title, booksList: booksList]
  }
}
