コード例 #1
0
ファイル: CommunityController.cs プロジェクト: plkkorea/HNS
        public async Task <IActionResult> Notice(int?page)
        {
            if (!page.HasValue)
            {
                page = 1;
            }
            else
            if (page.Value == 0)
            {
                page = 1;
            }

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

            if (searchModel != null && searchModel.NoticeSearchCriteria != null && !string.IsNullOrWhiteSpace(searchModel.NoticeSearchCriteria.SearchString))
            {
                searchModel.PageNumber = page.Value;
                searchModel            = await _noticeViewModel.SearchNotices(searchModel);

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

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

            NoticeViewModel searchModel = new NoticeViewModel();

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

            searchModel = await _noticeViewModel.SearchNotices(searchModel);

            return(View(searchModel));
        }