public IActionResult Index(int page = 1, int row = 5, string sortExpression = "Title", string title = "")
        {
            title = String.IsNullOrEmpty(title) ? "" : title;
            List <int> Rows = new List <int>
            {
                5, 10, 15, 20, 50, 100
            };

            ViewBag.RowID    = new SelectList(Rows, row);
            ViewBag.NumOfRow = (page - 1) * row + 1;
            ViewBag.Search   = title;

            var PagingModel = PagingList.Create(_repository.GetAllBooks(title, "", "", "", "", "", ""), row, page, sortExpression, "Title");

            PagingModel.RouteValue = new RouteValueDictionary
            {
                { "row", row },
                { "title", title }
            };

            ViewBag.Categories  = _repository.GetAllCategories();
            ViewBag.LanguageID  = new SelectList(_context.Languages, "LanguageName", "LanguageName");
            ViewBag.PublisherID = new SelectList(_context.Publishers, "PublisherName", "PublisherName");
            ViewBag.AuthorID    = new SelectList(_context.Authors.Select(t => new AuthorList {
                AuthorID = t.AuthorID, NameFamily = t.FirstName + " " + t.LastName
            }), "NameFamily", "NameFamily");
            ViewBag.TranslatorID = new SelectList(_context.Translator.Select(t => new TranslatorList {
                TranslatorID = t.TranslatorID, NameFamily = t.Name + " " + t.Family
            }), "NameFamily", "NameFamily");

            return(View(PagingModel));
        }
Пример #2
0
 public List <string> GetAllCategories()
 {
     return(repo.GetAllCategories());
 }