Пример #1
0
        static void Main(string[] args)
        {
            var library = new LibraryController();


            library.CheckoutItem("Name of the item");
        }
Пример #2
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);
        }