public ActionResult Index()
        {
            // TODO Get the comic books list.
            // Include the "Series" navigation property.
            var comicBooks = _comicBooksRepository.GetList();

            return(View(comicBooks));
        }
        public ActionResult Index()
        {
            // Update the calls to use the new Repository
            //var comicBooks = Repository.GetComicBooks();
            var comicBooks = _comicBooksRepository.GetList();

            return(View(comicBooks));
        }
        public ActionResult Index()
        {
            // this query taken from our repository class GetComicBooks() which
            // returns a list of comic books ordered by series title, then by issue number.
            var comicBooks = _comicBooksRepository.GetList();

            return(View(comicBooks));
        }
Example #4
0
        static void Main(string[] args)
        {
            _comicBookRepository = new ComicBooksRepository(context);
            string      command      = CommandListComicBooks;
            IList <int> comicBookIds = null;

            // If the current command doesn't equal the "Quit" command
            // then evaluate and process the command.
            while (command != CommandQuit)
            {
                switch (command)
                {
                case CommandListComicBooks:
                    comicBookIds = ListComicBooks();
                    break;

                case CommandAddComicBook:
                    AddComicBook();
                    command = CommandListComicBooks;
                    continue;

                case CommandArtist:
                    GetAllArtist();
                    break;

                default:
                    if (AttemptDisplayComicBook(command, comicBookIds))
                    {
                        command = CommandListComicBooks;
                        continue;
                    }
                    else
                    {
                        ConsoleHelper.OutputLine("Sorry, but I didn't understand that command.");
                    }
                    break;
                }

                // List the available commands.
                ConsoleHelper.OutputBlankLine();
                ConsoleHelper.Output("Commands: ");
                int comicBookCount = _comicBookRepository.GetList().Count;
                if (comicBookCount > 0)
                {
                    ConsoleHelper.Output("Enter a Number 1-{0}, ", comicBookCount);
                }
                ConsoleHelper.OutputLine("A - Add, Q - Quit", false);

                // Get the next command from the user.
                command = ConsoleHelper.ReadInput("Enter a Command: ", true);
                context.Dispose();
            }
        }
Example #5
0
        /// <summary>
        /// Retrieves the comic books from the database and lists
        /// them to the screen.
        /// </summary>
        /// <returns>A collection of the comic book IDs in the same order
        /// as the comic books were listed to facilitate selecting a comic book
        /// by its line number.</returns>
        private static IList <int> ListComicBooks()
        {
            _comicBookRepository = new ComicBooksRepository(context);
            var comicBookIds             = new List <int>();
            IList <ComicBook> comicBooks = _comicBookRepository.GetList();

            ConsoleHelper.ClearOutput();
            ConsoleHelper.OutputLine("COMIC BOOKS");

            ConsoleHelper.OutputBlankLine();

            foreach (ComicBook comicBook in comicBooks)
            {
                comicBookIds.Add(comicBook.Id);

                ConsoleHelper.OutputLine("{0}) {1}",
                                         comicBooks.IndexOf(comicBook) + 1,
                                         comicBook.DisplayText);
            }

            context.Dispose();
            return(comicBookIds);
        }
Example #6
0
        public ActionResult Index()
        {
            var comicBooks = _comicBooksRepository.GetList();

            return(View(comicBooks));
        }