示例#1
0
        public async Task <IActionResult> Qna(int?page)
        {
            if (!page.HasValue)
            {
                page = 1;
            }
            else
            if (page.Value == 0)
            {
                page = 1;
            }

            var searchModel = HttpContext.Session.GetObjectFromJson <QnaViewModel>("QnaViewModel");

            if (searchModel != null && searchModel.QnaSearchCriteria != null && !string.IsNullOrWhiteSpace(searchModel.QnaSearchCriteria.SearchString))
            {
                searchModel.PageNumber = page.Value;
                searchModel            = await _qnaViewModel.SearchQnas(searchModel);

                return(View(searchModel));
            }
            else
            {
                var model = await _qnaViewModel.GetAllQnas(page.Value);

                return(View(model));
            }
        }
示例#2
0
        public async Task <IActionResult> Qna(int?page, int?searchtype, string query)
        {
            if (!page.HasValue)
            {
                page = 1;
            }
            else
            if (page.Value == 0)
            {
                page = 1;
            }

            QnaViewModel searchModel = new QnaViewModel();

            searchModel.PageNumber = page.Value;
            if (!string.IsNullOrWhiteSpace(query))
            {
                searchModel.QnaSearchCriteria.SearchType   = (Qna.SearchType)searchtype.Value;
                searchModel.QnaSearchCriteria.SearchString = query;
            }

            searchModel = await _qnaViewModel.SearchQnas(searchModel);

            return(View(searchModel));
        }