Example #1
0
        public ActionResult Index()
        {
            List <BookViewModel> books = new List <BookViewModel>();

            books.AddRange(repo.GetAllBooks().Select(b => Mapper.Map <BookViewModel>(b)));
            ViewBag.IsAdmin = repo.IsAdmin();

            var sets       = repo.GetAllSets();
            var categories = repo.GetAllCategories();

            return(View(new HomeViewModel(books, sets, categories)));
        }
Example #2
0
        static void Main(string[] args)
        {
            foreach (var item in BooksRepo.GetAllBooks())
            {
                Console.WriteLine(item.Name);
                Console.WriteLine("---------------------------------------------------------");
            }


            foreach (var item2 in BooksRepo.GetBooksByGenreId(1))
            {
                Console.WriteLine(item2.Name);
            }
            Console.ReadKey();
        }