Пример #1
0
        public IActionResult Detail(int id)
        {
            var bookDetail       = booksRepository.GetBookById(id);
            var detailsWithStats = booksRepository.AddStats(bookDetail);

            ViewData["itemsClass"] = "detail-entry";
            return(View(detailsWithStats));
        }
Пример #2
0
        public IActionResult Index()
        {
            var bookList          = booksRepository.GetBooksFromUser(User.Identity.Name);
            var bookWithStatsList = new List <BookWithStats>();

            //Calculate stats for each book and store in list
            foreach (var book in bookList)
            {
                bookWithStatsList.Add(booksRepository.AddStats(book));
            }

            var booksSorted = from book in bookWithStatsList
                              orderby book.DateFinished
                              select book;

            ViewData["itemsClass"] = "card-entry";
            return(View(booksSorted));
        }