Example #1
0
        static void Bootstrap(IRepository repository)
        {
            //setup Library
            var library = new Model.Library(repository.GetUsers(), repository.GetBooks());

            //setup controller
            var commandProcessors = new List <ICommandProcessor>
            {
                new AddBookCommandProcessor(library, repository),
                new AddUserCommandProcessor(library, repository),
                new BorrowBookCommandProcessor(library, repository),
                new ReturnBookCommandProcessor(library, repository)
            };

            _libraryController = new LibraryController(commandProcessors);

            //setup view
            var views    = new List <IView>();
            var helpView = new HelpView(commandProcessors, views, "show help");

            views.AddRange(
                new IView[] {
                new BookView(library.Books, "show books"),
                new UserView(library.Users, "show users"),
                new UserView(library.BadUsers, "show bad users"),
                helpView
            });
            _libraryView = new LibraryView(library, views, helpView);
        }
Example #2
0
 public async Task updateLibrary(Model.Library library)
 {
     await this.db.updateLibrary(library);
 }
Example #3
0
 public async Task <Model.Library> createLibrary(Model.Library library)
 {
     return(await this.db.createLibrary(library));
 }