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))); }
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(); }