예제 #1
0
        public async Task <IActionResult> SearchDiscipline(string searchWord)
        {
            ViewData["Title"]      = "Результат пошуку: " + searchWord;
            ViewData["SearchWord"] = searchWord;
            var emptyModel = new DisciplinePagination {
                Disciplines = new List <Discipline>(), Pager = new Pager(0, 0)
            };

            if (String.IsNullOrEmpty(searchWord))
            {
                return(View(emptyModel));
            }
            var dummyItems = await _DisciplineRepository.GetBySearchTextAsync(searchWord);

            if (dummyItems == null)
            {
                return(View(emptyModel));
            }
            var pager     = new Pager(dummyItems.Count(), 1, dummyItems.Count());
            var viewModel = new DisciplinePagination
            {
                Disciplines = dummyItems,
                Pager       = pager
            };

            return(View(viewModel));
        }