Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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];
            };
        }