Exemplo 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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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];
            };
        }
Exemplo n.º 4
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]);
            };
        }