public CollectionModule(IBookCollectionDb bookCollectionDb, IBookDb bookDb) { _bookCollectionDb = bookCollectionDb; _bookDb = bookDb; Get["/collection"] = _ => BookCollection(); Get["/collection/del/{id}"] = param => DeleteCollection(param.id); Get["/collection/add/{bookid}"] = param => AddCollection(param.bookid); }
public IndexModule(IBookDb bookDB) { this.bookDb = bookDB; Get["/"] = _ =>{ var bookName = "book1"; var books = bookDb.FindBookByName (bookName); if (books.Count == 0) { bookDb.Add (new Book () { name = bookName }); books = bookDb.FindBookByName (bookName); }; return View["index",books]; }; }
public IndexModule(IBookDb bookDB) { this.bookDb = bookDB; Get["/"] = _ => { var bookName = "book1"; var books = bookDb.FindBookByName(bookName); if (books.Count == 0) { bookDb.Add(new Book() { name = bookName }); books = bookDb.FindBookByName(bookName); } ; return(View["index", books]); }; }